• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

winXP equivalent to swapon?

Special K

Diamond Member
I am trying to use a windows port of a linux memory debugger called electric fence. In the documentation, which was only written for the linux version, it says the following:

Since Electric Fence uses at least two virtual memory pages for each of its allocations, it's a terrible memory hog. I've sometimes found it necessary to add a swap file using swapon() so that the system would have enough virtual memory to debug my program.

What would be the equivalent of swapon in windows? I keep getting an error saying windows couldn't allocate enough virtual memory when I try to run this debugging library with my program.

The exact error message is:

VirtualAlloc(8192) failed: NULL
 
The equivalent would be to raise the size of your page file and then reboot. Windows automatically turns the swap on.
 
Originally posted by: xtknight
The equivalent would be to raise the size of your page file and then reboot. Windows automatically turns the swap on.

Well I set it to let windows manage the swap file, but I am still getting the same error message. Won't windows make the page file as big as it needs to? Why would the program still be giving me that error saying it can't allocate anymore virtual memory? The page file is only at about 1 GB when the program gives the error message.

 
How much memory is the program using before it crashes? I wonder why it needs mounds and mounds of memory. It sounds like a bug to me, unless you are debugging a giant program or one that uses tons of resources.

Is it a Windows kernel error message or one from the program that states 'Windows cannot allocate more memory'? The function could be returning NULL because of a bug in the debugger (how ironic) as well. I don't know whether or not Windows dynamically expands the page file. I think that it determines a minimum and maximum size automatically for you, and it can use up to the maximum.
 
Originally posted by: xtknight
How much memory is the program using before it crashes? I wonder why it needs mounds and mounds of memory. It sounds like a bug to me, unless you are debugging a giant program or one that uses tons of resources.

Is it a Windows kernel error message or one from the program that states 'Windows cannot allocate more memory'? The function could be returning NULL because of a bug in the debugger (how ironic) as well. I don't know whether or not Windows dynamically expands the page file. I think that it determines a minimum and maximum size automatically for you, and it can use up to the maximum.


The actual error message displayed is generated by the debugger, although I checked the source code to the debugger and it is making a direct call to windows for a virtual memory allocation.

The debugger does use up a lot of memory - something like 2 pages of VM per memory allocation call in the program you are debugging.
 
Each process can only use 2G of VM on a 32-bit system and then you still have to subtract space for the binary itself, any required libraries and anything else that's mmap()'d in there. Have you checked to make sure you're not hitting that ceiling?
 
Originally posted by: Nothinman
Each process can only use 2G of VM on a 32-bit system and then you still have to subtract space for the binary itself, any required libraries and anything else that's mmap()'d in there. Have you checked to make sure you're not hitting that ceiling?

How exactly do I check this? In task manager?

 
How exactly do I check this? In task manager?

Maybe, there is a VM size column in there. I've heard a lot of people talk about how much better than taskmgr Process Explorer is, it might be worth checking out too.
 
Originally posted by: Nothinman
How exactly do I check this? In task manager?

Maybe, there is a VM size column in there. I've heard a lot of people talk about how much better than taskmgr Process Explorer is, it might be worth checking out too.

It doesn't seem to be coming anywhere close to that. I enabled the 'VM Size" column in task manager and it gets to a bit over 256 MB when the program says it can't allocate anymore virtual memory.
 
Back
Top