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. Creating large DIB's using CreateDIBSection and CreateFileMapping

Creating large DIB's using CreateDIBSection and CreateFileMapping

Scheduled Pinned Locked Moved C / C++ / MFC
helpgraphicsperformancequestion
2 Posts 2 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.
  • H Offline
    H Offline
    HockeyNut
    wrote on last edited by
    #1

    I have a situation where users are trying to create large 24bit DIBs (10,000 x 10,000) or greater and CreateDIBSection is failing. The problem appears to occur when virtual memory gets low. I can create the large DIBs when I don't have a lot of memory allocated for other things. I tried using the following: HANDLE hFileMap = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, dwStorageSize,NULL); dwLE = GetLastError(); if(INVALID_HANDLE_VALUE == hFile) hFile = NULL; if( NULL == hFileMap) ErrMsg( dwLE); LPVOID pDibBits = NULL; HBITMAP hBitmap = ::CreateDIBSection( NULL, m_bitmapinfo, DIB_RGB_COLORS, pDibBits, hFileMap, 0); dwLE = GetLastError(); The thought was that using CreateFileMapping() to allowcate memory for the DIB bits when memory was low but it still fails and GetLastError() return 0 which does not help. Is there a way to use swap file or temporary disk files as storage space for DIB bits when processing large bitmap files?

    R 1 Reply Last reply
    0
    • H HockeyNut

      I have a situation where users are trying to create large 24bit DIBs (10,000 x 10,000) or greater and CreateDIBSection is failing. The problem appears to occur when virtual memory gets low. I can create the large DIBs when I don't have a lot of memory allocated for other things. I tried using the following: HANDLE hFileMap = CreateFileMapping( INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, dwStorageSize,NULL); dwLE = GetLastError(); if(INVALID_HANDLE_VALUE == hFile) hFile = NULL; if( NULL == hFileMap) ErrMsg( dwLE); LPVOID pDibBits = NULL; HBITMAP hBitmap = ::CreateDIBSection( NULL, m_bitmapinfo, DIB_RGB_COLORS, pDibBits, hFileMap, 0); dwLE = GetLastError(); The thought was that using CreateFileMapping() to allowcate memory for the DIB bits when memory was low but it still fails and GetLastError() return 0 which does not help. Is there a way to use swap file or temporary disk files as storage space for DIB bits when processing large bitmap files?

      R Offline
      R Offline
      RodgerB
      wrote on last edited by
      #2

      Its not a question of having enough RAM, you need to have enough address space available in your process. I think you won't have this issue on a 64 bit OS and a 64 bit process. Even a 32 bit process on a 64 bit OS helps as long as the process is Large Address Aware.

      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