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. GlobalAlloc fails!

GlobalAlloc fails!

Scheduled Pinned Locked Moved C / C++ / MFC
performancehelpquestion
5 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.
  • J Offline
    J Offline
    Justin Hallet
    wrote on last edited by
    #1

    I have an application that is getting NULL returned from GlobalAlloc, the error code says "not enough storage avaliable" but that does not make sence. The application has a working set of 450Mb and a virtual set of 790Mb, my machine has 1Gb of physical ram and 2.5Gb total (including virtual memory). This error does not happen on a machine with 2Gb of ram. The request is only for 100Mb. Any ideas why GlobalAlloc should fail? Could it be address space? Are there any compiler/linker flags I can change for MSVC 6?

    C 1 Reply Last reply
    0
    • J Justin Hallet

      I have an application that is getting NULL returned from GlobalAlloc, the error code says "not enough storage avaliable" but that does not make sence. The application has a working set of 450Mb and a virtual set of 790Mb, my machine has 1Gb of physical ram and 2.5Gb total (including virtual memory). This error does not happen on a machine with 2Gb of ram. The request is only for 100Mb. Any ideas why GlobalAlloc should fail? Could it be address space? Are there any compiler/linker flags I can change for MSVC 6?

      C Offline
      C Offline
      Chris Losinger
      wrote on last edited by
      #2

      Justin Hallet wrote: Any ideas why GlobalAlloc should fail? try calling GetLastError . what are you using for uFlags on the GlobalAlloc call? -c


      Image tools: ThumbNailer, Bobber, TIFFAssembler

      J 1 Reply Last reply
      0
      • C Chris Losinger

        Justin Hallet wrote: Any ideas why GlobalAlloc should fail? try calling GetLastError . what are you using for uFlags on the GlobalAlloc call? -c


        Image tools: ThumbNailer, Bobber, TIFFAssembler

        J Offline
        J Offline
        Justin Hallet
        wrote on last edited by
        #3

        I have, GetLastError, returns ERROR_NOT_ENOUGH_MEMORY, "Not enough storage is available to process this command." Call is - GlobalAlloc ( GMEM_MOVEABLE | GMEM_ZEROINIT, aSize ), where size is about, 1048576.

        C 1 Reply Last reply
        0
        • J Justin Hallet

          I have, GetLastError, returns ERROR_NOT_ENOUGH_MEMORY, "Not enough storage is available to process this command." Call is - GlobalAlloc ( GMEM_MOVEABLE | GMEM_ZEROINIT, aSize ), where size is about, 1048576.

          C Offline
          C Offline
          Chris Losinger
          wrote on last edited by
          #4

          could be you've fragmented the memory so bad that it can't find 100MB of continuous memory. (unlikely). do you do a lot of little allocations elsewhere? -c


          Image tools: ThumbNailer, Bobber, TIFFAssembler

          J 1 Reply Last reply
          0
          • C Chris Losinger

            could be you've fragmented the memory so bad that it can't find 100MB of continuous memory. (unlikely). do you do a lot of little allocations elsewhere? -c


            Image tools: ThumbNailer, Bobber, TIFFAssembler

            J Offline
            J Offline
            Justin Hallet
            wrote on last edited by
            #5

            Just a few, actually, I think you may be right here, I think it is fragmentation, I will check the size, I had assumed it was 100Mb, it could be more like 700Mb in which case fragmentation will be the problem.

            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