Question Locked

Error in malloc and/or HeapAlloc with memory available

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hello All,

I've been tearing my hair out and I think it is because of some anachronistic content on the Microsoft websites (and even in the 4th edition windows internals book).

The problem is this:
I have a critical graphics rendering application running on an x86 32-bit quad core machine under XP Pro SP3 with 4GB of RAM and a 1GB graphics card. Relax, this is not THAT question again -- I know only 3GB should show up in total memory!

My process is attempting to allocate with either malloc or HeapAlloc, another 25MB of memory, after the working set is about 1.4GB and the virtual address space is about 1.7GB (by using the process explorer from MS/SysInternals). From the WS and VM size, it would seem I should be able to allocate more memory. I even checked for memory fragmentation by trying smaller values, and it seems I'm pretty close to the max amount I can allocate.

MY malloc returns NULL, and to check further, I used HeapAlloc instead which returned "not enough quota" 0xC0000017 as an exception.

After reading my new 4th edition sys internals book, I found some text referring to a paging file quota per process, and I've seen just scant snippets of same on the web, but nothing that tells me how to adjust it. There are hits at microsoft that say "this message means you need to have your quota increased" (duh!), which are about as useless as I can think of.

I HAVE NOT tried merely increasing my pagefile, because it is at 4095 max space anyway, but what about this pagefile quota? Is it real, or as I suspect, is it a leftover from days when windows worked more like VMS than it does now? Does increase the pagefile quota just mean increase the size of the file?
That's not the way it was in VMS -- that was pgflquo, or something (I'm SYSGEN/AUTOGEN kinda guy from those days....)

BTW, to clarify, this question IS NOT ABOUT how I could increase memory on this system, but ONLY about the pagefile quota. I know many ways to increase the memory, but I am curious about this since there appear to be no intelligent hits on it on the internet.

Does anyone out there have the answer?

-thanks
-e

2 replies

by Former member

It sounds like the old Windows memory allocation rules, but i may be wrong.
With Windows XP the memory allocation rules are made differently, by default, Windows XP creates the page file in the root folder of the same drive that holds the system files. The size of this file depends on the amount of physical RAM installed.

To be able to see this file you need to ensure Windows XP has been configured to show hidden and system files. You can do this by opening Windows Explorer, clicking Tools, and then Folder Options. Then, from the View tab in the Advanced Settings windows, go to the Hidden Files And Folders folder and checkmark the Show Hidden Files And Folders option.

Now open Windows Explorer and in the left pane click your root drive, which is normally drive C:. You'll be able to see the size of the page file by looking in the right pane of Windows Explorer for the file, PAGEFILE.SYS.

More on it here:
http://www.practicalpc.co.uk/computing/windows/xpvirtualmemory.htm

More info on Malloc and alloca function here:
http://en.wikipedia.org/wiki/Malloc

More info on HeapAlloc here:
http://msdn.microsoft.com/en-us/library/ms885654.aspx

Please post back if you have any more problems or questions.
If this information is useful, please mark as helpful. Thanks.

This discussion is closed to new replies.