Pre-allocation of virtual memory
-
Hi all, Is there a way to pre-allocate some large amount of virtual memory for a process and then let it use? I have the following problem: there is a very important service that use large amount of memory (up to 400MB and more) but its memory usage depends on time: sometime uses as low as 4MB of memory, sometimes 400MB. Sometimes it happens that it cannot find 400MB free because other less important processes uses it. A possible solution would be to pre-allocate 400MB, and then let 'malloc' and 'new' allocate from the pre-allocated pool. Do you know a way to do it in W2K/XP? Thanks a lot in advance. Regards, Andrea
-
Hi all, Is there a way to pre-allocate some large amount of virtual memory for a process and then let it use? I have the following problem: there is a very important service that use large amount of memory (up to 400MB and more) but its memory usage depends on time: sometime uses as low as 4MB of memory, sometimes 400MB. Sometimes it happens that it cannot find 400MB free because other less important processes uses it. A possible solution would be to pre-allocate 400MB, and then let 'malloc' and 'new' allocate from the pre-allocated pool. Do you know a way to do it in W2K/XP? Thanks a lot in advance. Regards, Andrea
You could overload the new operator and handle the details yourself... See MSDN article "How to overload new..." http://support.microsoft.com/default.aspx?scid=kb;en-us;139638[^] Hope that helps. Karl - WK5M PP-ASEL-IA (N43CS) PGP Key: 0xDB02E193 PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
-
Hi all, Is there a way to pre-allocate some large amount of virtual memory for a process and then let it use? I have the following problem: there is a very important service that use large amount of memory (up to 400MB and more) but its memory usage depends on time: sometime uses as low as 4MB of memory, sometimes 400MB. Sometimes it happens that it cannot find 400MB free because other less important processes uses it. A possible solution would be to pre-allocate 400MB, and then let 'malloc' and 'new' allocate from the pre-allocated pool. Do you know a way to do it in W2K/XP? Thanks a lot in advance. Regards, Andrea
Did you try VirtualAlloc?
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENS -
Did you try VirtualAlloc?
:suss: Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
Painted on the side of a dog trainer's van: SIT HAPPENSHi, unfortunately I have to reserve a large amount of global virtual memory because virtual memory (either physical or in page file) is a shared, limited resource. The article about the heap should fit but I still do not undestand how to use STL::new and malloc without making custom allocation classes. So the problem is still open... regards, Andrea