Solved

Unable to allocate more than 600 MB of ram

Posted on 2009-03-29
3
594 Views
Last Modified: 2013-11-10
I am running into one hell of a weird memory problem...

A DLL library containing mixed managed and unmanaged C++ code is trying to allocate several large arrays of memory (around 160 MB X 4). The system currently has more than 2 GB of free memory so obviously it's not a true out of memory problem. The code that requires the memory is unmanaged. A managed C# program uses the DLL library. I tested the program immediatly after Windows started so this could not possibly be a memory fragmentation problem.

I tried using VirtualAlloc(), HeapAlloc(), GlobalAlloc(). All failed at exactly 600 MB. I tried creating a new private heap using CreateHeap() to overcome what appears to be an artificial limit but that did not work. I even tried using the page file directly using CreateFileMapping() to no avail.

Using 64bit operating systems to overcome the 2GB per process limit is not an option.

What to do? #_#
0
Comment
Question by:Ameerh24
3 Comments
 
LVL 16

Expert Comment

by:warturtle
ID: 24012510
Try to disable any antivirus software and try again. Secondly, try to disable Data Execution Prevention and re-execute the code again.
0
 

Author Comment

by:Ameerh24
ID: 24013467
I don't think this has anything to do with the Antivirus or DEP as I am neither executing code from memory nor am I having any buffer overflows. The problem is in allocation. Using the new keyword returns std:bad_alloc and malloc returns NULL. For the sake of testing I disabled both but that did not help.
0
 
LVL 39

Accepted Solution

by:
abel earned 500 total points
ID: 24016964
Is it possible for you to show a small example the way (one of the ways) you try to allocate memory? I have a 4GB system here, also 32 bit, Vista, and I may have the same results, in which case I can copy your situation.

Btw, iyou do say you use managed and unmanaged together. Sounds somehow that you bumped into the maximum memory size allowed by the CLR. From my memory, I think that should be unlimited (set in machine.config) but maybe it is set to a maximum?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

We have adopted the strategy to use Computers in Student Labs as the bulletin boards. The same target can be achieved by using a Login Notice feature in Group policy but it’s not as attractive as graphical wallpapers with message which grabs the att…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup". After a while, you have entered a loop for Auto repair which does not fix anything and you will be in a  panic as all your work w…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now