Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CreateCompatibleBitmap and mem allocation

CreateCompatibleBitmap and mem allocation

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++performancequestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IGeorgeI
    wrote on last edited by
    #1

    Hello everyone I am using CreateCompatibleBitmap to create bitmaps of my list of worksheets. The problem is, when I hit around 20 bitmaps in a loop, the CreateCompatibleBitmap call begins to fail. I have traced into the MFC function calls and I discovered that the memory allocation on the HEAP has reached its limit for creating more resources. Has anybody ever seen this before?? If not, does anybody have any suggestions?? Thank you for you help IGeorgeI George W Software Developer www.zsystems.ca

    J V 2 Replies Last reply
    0
    • I IGeorgeI

      Hello everyone I am using CreateCompatibleBitmap to create bitmaps of my list of worksheets. The problem is, when I hit around 20 bitmaps in a loop, the CreateCompatibleBitmap call begins to fail. I have traced into the MFC function calls and I discovered that the memory allocation on the HEAP has reached its limit for creating more resources. Has anybody ever seen this before?? If not, does anybody have any suggestions?? Thank you for you help IGeorgeI George W Software Developer www.zsystems.ca

      J Offline
      J Offline
      Johan Rosengren
      wrote on last edited by
      #2

      I've seen it when the bitmaps are very large, or leaked. I would try to structure the code so that I didn't need more than one bitmap at any given time, making sure to properly deselect them from any CDC , if appropriate. And, of course, calling DeleteObject , either directly or by having the dtor of the CBitmap invoked.

      1 Reply Last reply
      0
      • I IGeorgeI

        Hello everyone I am using CreateCompatibleBitmap to create bitmaps of my list of worksheets. The problem is, when I hit around 20 bitmaps in a loop, the CreateCompatibleBitmap call begins to fail. I have traced into the MFC function calls and I discovered that the memory allocation on the HEAP has reached its limit for creating more resources. Has anybody ever seen this before?? If not, does anybody have any suggestions?? Thank you for you help IGeorgeI George W Software Developer www.zsystems.ca

        V Offline
        V Offline
        Vadim Tabakman
        wrote on last edited by
        #3

        How big are the bitmap sizes? I used CreateCompatibleBitmap often in code I work with, and have not come across this issue. I very interested in what the bitmap sizes are, that cause the heap to fill up. thanx

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups