Hi, I met an interesting question:
- load a big (4500x6000) jpeg into memory (RGBRGBRGB....) by libjpeg (cost about 200M memory)
- CreateDIBitmap() to create a HBITMAP from the data
- free the memory used
now I found that the process use only 5M memory at all. I wonder where is the data of the HBITMAP. (I disable pagefile)
update:
I write such code for testing:
// initilise
BITMAP bitmap;
BITMAPINFO info;
// ....
void *data = NULL;
HDC hdc = ::GetDC(NULL);
HBITMAP hBitmap = ::CreateDIBSection(hdc, &info, DIB_RGB_COLORS, &data, NULL, 0);
::ReleaseDC(NULL, hdc);
if (hBitmap) {
::GetObject(m_hBitmap, sizeof(bitmap), &bitmap);
}
Then the data is 0x2d0000 (surely in user space), bitmap.bmBits is also 0x2d0000. So I make sure that CreateDIBSection use user space memory for bitmap.