Solved

Unable to allocate more than 600 MB of ram

Posted on 2009-03-29
3
596 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Valere unit 6 68
Fan for HP TouchSmart 600-1265qd CTO Desktop PC 7 77
USB ports on desktop not working 10 63
Power supply fan not spinning 12 47
Sometimes people don't understand why download speed shows differently for Windows than Linux.Specially, this article covers and shows the solution for throughput difference for Windows than a Linux machine. For this, I arranged a test scenario.I…
More and more people are using the enhanced small form-factor pluggable (SFP+) tranceivers, and speed is of utmost importance. Testing of speeds are critical to ensure that the devices will meet the speed requirements. There are some testing challen…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

776 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