#18183 closed bug (no change required)

Strange out of memory issue while allocating many bitmaps

Reported by: jackburton Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: System Version:
Keywords: Cc:
Blocked By: Blocking:
Platform: x86

Description (last modified by jackburton)

While trying to fix a problem in BeScreenCapture I managed to create a test application which reproduces the problem. The attached test application allocates many bitmaps (300) and adds them to list

On haiku 32 bit it fails after 100 bitmaps, more or less, with "Out of memory".

but doesn't seem so, looking at ActivityMonitor or ProcessController. Works fine with less than 100 bitmaps.

The system I'm testing it on has 4GB ram, and virtual memory is enabled and set to be managed by system.

Compile with:

gcc -g -lbe -lroot -ltranslation -lstdc++.r4 -o bitmaptest main.cpp

Attachments (1)

main.cpp (971 bytes ) - added by jackburton 17 months ago.
Simplified test case

Download all attachments as: .zip

Change History (8)

comment:1 by jackburton, 17 months ago

Description: modified (diff)

comment:2 by jackburton, 17 months ago

Description: modified (diff)

comment:3 by jackburton, 17 months ago

Further simplified test case: it seems that earlier BBitmap::InitCheck() fails, so there's no need to save bitmaps to disk to reproduce the problem.

by jackburton, 17 months ago

Attachment: main.cpp added

Simplified test case

comment:4 by jackburton, 17 months ago

Description: modified (diff)
Summary: Strange out of memory issue while allocating bitmaps and saving to diskStrange out of memory issue while allocating many bitmaps

comment:5 by pulkomandy, 17 months ago

At this resolution, each bitmap is 9MB, so a hundred of them is 900MB.

On a 32bit system, it is not very hard to hit the max memory size of app_server (about 2GB). There is simply no way to fit 300 9MB bitmaps in that address space.

Even if you have more free RAM, one single app can only use up to 2GB due to the 32bit address space constraint.

The only fix here is to switch to 64bit...

comment:6 by jackburton, 17 months ago

Right. Closing this, then.

comment:7 by jackburton, 17 months ago

Resolution: no change required
Status: newclosed
Note: See TracTickets for help on using tickets.