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. GlobalRealloc big problem ....

GlobalRealloc big problem ....

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
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.
  • _ Offline
    _ Offline
    _crs_
    wrote on last edited by
    #1

    hello, I have a code that raise this error "Not enough storage is available to process this command." when I try to Realloc a buffer .... temp = (DWORD)GlobalReAlloc((HGLOBAL)eyeConClients[msg - SOCKET_ID - 1].buffer, szTemp, GMEM_MOVEABLE); this works ok many times ... and randomly raise that error .... any suggestions ? please help .... thanks !!!

    R A 2 Replies Last reply
    0
    • _ _crs_

      hello, I have a code that raise this error "Not enough storage is available to process this command." when I try to Realloc a buffer .... temp = (DWORD)GlobalReAlloc((HGLOBAL)eyeConClients[msg - SOCKET_ID - 1].buffer, szTemp, GMEM_MOVEABLE); this works ok many times ... and randomly raise that error .... any suggestions ? please help .... thanks !!!

      R Offline
      R Offline
      Ryan Binns
      wrote on last edited by
      #2

      GlobalRealloc() does not necessarily return the same memory handle as the one passed to it - it's value may change. You need to store the new value:

      eyeConClients[msg - SOCKET_ID - 1].buffer = GlobalReAlloc((HGLOBAL)eyeConClients[msg - SOCKET_ID - 1].buffer, szTemp, GMEM_MOVEABLE);

      If you need to cast your buffer to a HGLOBAL, you will need to cast the return value of GlobalRealloc() to make it fit with your buffer variable. You didn't say what type it was, so I don't know what to cast it to - you'll need to do that. Hope this helps, Ryan Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
      Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"

      1 Reply Last reply
      0
      • _ _crs_

        hello, I have a code that raise this error "Not enough storage is available to process this command." when I try to Realloc a buffer .... temp = (DWORD)GlobalReAlloc((HGLOBAL)eyeConClients[msg - SOCKET_ID - 1].buffer, szTemp, GMEM_MOVEABLE); this works ok many times ... and randomly raise that error .... any suggestions ? please help .... thanks !!!

        A Offline
        A Offline
        AlexO
        wrote on last edited by
        #3

        what is the value and datatype of szTemp? What amount of physical memory available at the moment of the error? What is the page file size? What is the error number?

        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