In which case, realloc returns NULL???

Discussion in 'Windows 64 Bit' started by shahul, Mar 30, 2006.

  1. shahul

    shahul Guest

    hi pals,

    My win32 console application has allocated memory of 350MB in Memory usage
    column and 400MB in Virtual memory column. While reallocating a global
    variable , getting NULL if the size is too high (say 200MB). What is the
    maximum memory size that an application can use? What are the scenario, that
    realloc returns NULL.


    @ Shahul.
     
    shahul, Mar 30, 2006
    #1
    1. Advertisements

  2. *alloc uses heap memory. What you would need is VirtualAlloc then. But
    still, a win32 app, cannot address more memory than 4GB (even if you have
    installed more hardware RAM). However, in practise, this memory never will
    go beyond 2GB unless you use specific hardware & software extensions
    (windows (win32) enterprise edition can address 64 GYG)

    Still, if you allocate that much virtual memory, your swap disk, really gets
    stressed. I would redesign your solution. If you are talking about a
    database table, or something like that that uses that much memory, use a
    cursor mechanism.
     
    Egbert Nierop \(MVP for IIS\), Mar 30, 2006
    #2
    1. Advertisements

  3. Hi shahul!
    If there is no continues chunck of memory in the requested size. See:

    How to get the largest available continues memory block
    http://blog.kalmbachnet.de/?postid=9


    --
    Greetings
    Jochen

    My blog about Win32 and .NET
    http://blog.kalmbachnet.de/
     
    Jochen Kalmbach [MVP], Mar 30, 2006
    #3
  4. You're NOT making any "pals" by crossposting to groups that have nothing to
    do with your post. See the link below for information on how to use
    newsgroups properly.

    Shame on the MVPs who crossposted their responses and set no follow up. Of
    course, if you're using a sad newsreader like OE or Thunderbird...

    Follow up set to:

    microsoft.public.win32.programmer.directx.sdk
     
    The March Hare [MVP], Mar 30, 2006
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.