PgDrawBitmap() calls malloc() ?


I’m testing Photon 1.13 in stress conditions (under QNX 4.25). Here’s
what I do :

  • Start Photon and graphic driver ( during boot (pwm, pdm… do
    not run)
  • Launch a program that:
  • creates a PtWindow with a PtRaw inside, and PtRealize() it,
  • hogs all available RAM by calling malloc() many times, until it
  • call various PgXXX functions to draw inside the window.

When testing PgDrawBitmap(), I get this message on the console:
“Photon: malloc failed attempting to allocated 3704 bytes”

This message appears several times (24).

BUT strangely, what I can see on screen seems to be normal !!!

My bitmap is 128x228 pixels large, one plane.
It seems that using smaller bitmaps (e.g 25x35) don’t give this message.


  • why these mallocs ? (for interest only)
  • why does my program seems to work correctly in spite of these failed
    mallocs ?
  • in which case does Photon needs to malloc() ? Does it depends on the
    bitmap size ?
  • can I tell Photon to avoid malloc’ing ?

Gilles Barges,
software engineer, Technicatome

I’m testing Photon 1.13 in stress conditions (under QNX 4.25). […]

An important correction to my previous post.

I was saying that, in spite of malloc() failures in Photon, I could see a
correct result on screen.
This is not true.

The test displays a small animation, made of 20 bitmaps, in a loop.
Each bitmap is drawn, then I wait 20 ms and blit the BM again with the
window background color to clear it.
Then the same for next BM …

When lauching the test, I get the “malloc failed” message many times, and
nothing is drawn.
Then, after some time, the message isn’t issued anymore and I can see my BMs
on the screen.
Seems that everything finally works.

Gilles Barges,
software engineer, Technicatome