Definition: | killDib(a32Dib dib) |
Description: | Removes a bitmap from memory. |
Comments: |
It is extremely important to dispose of bitmaps that you no longer need, and ideally as soon as possible.
Assuming you are not running a memory leak checking build of phix, should you create (/load) a bitmap at the start of an application that you need throughout, and forget to destroy it just before the application shuts down, no-one really cares. However, if you create a temporary bitmap, say, during a WM_PAINT message, and fail to get rid of it properly, your application will very likely run out of memory rather quickly. There is a default limit of 200 simultaneously active bitmaps, which can be increased by a maxBitmaps(integer n) call. In terms of what a modern machine should be expected to cope with, if all the bitmaps were hi-res fullscreen (1920*1080), then 200 is actually a realistic limit (2GB), at least for a 32-bit app. If they were all much smaller, for instance to be used on toolbar buttons, then hundreds of thousands of them might well be possible, not that I’ve tried. If the limit is breached, the application terminates with the message "a32dcore: maximum number of bitmaps exceeded". Obviously the ideal is to get it to crash (when it is forgetting to call killDib) fairly soon after launch, rather than get slower and slower before eventually dying several hours or even days later. |