tags:

views:

97

answers:

1

I am using the following code to create a compatible DC:

m_pDC=new CDC();
VERIFY(m_pDC->CreateCompatibleDC(sampleDC);
CBitmap bitmap; 
if (bitmap.CreateCompatibleBitmap(sampleDC, rect.Width(), rect.Height()))
{
   m_pOldBitmap = m_pDC->SelectObject(&bitmap);
}

My question is does CDC CBitmap occupied memory ? If it is using memory, why does it get bad result when rect.width and rect.height are large. (There are enough memory). Someone said it is using memory on video card. Is it true. I am not very sure about it.

+2  A: 

Memory in CreateCompatibleBitmap are allocated from a system-wide pool that's typically limited to about 200 Megabytes on 32-bit versions of Windows.

Since WinNT4.0 CreateBitmap() API allocates the bitmap in kernel-mode paged memory. In WinNT4 it was impossible to create bitmaps greater than 48 MB.

What was your limit?

Kirill V. Lyadvinsky
..... why give jia3ep -2 without any comment?have a better answer?