Freeing memory error?

前端 未结 2 357
栀梦
栀梦 2020-12-21 12:49

I need to free the bitpointer, because this function is executed multiple times and memory usage is growing for a reason I don\'t understand and it crashes afte

2条回答
  •  隐瞒了意图╮
    2020-12-21 13:09

    In SelectObject, save the returned value: HGDIOBJ save = SelectObject(hdcTemp, hBitmap2);

    Then before ReleaseDC, delete the DIB DeleteObject( SelectObject(hdcTemp, save) );

    Otherwise, you create bitmaps and don't delete them.

提交回复
热议问题