Re: Recover/defrag memory API

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



How do you know that his solution won't work in your case? Did you try
it? I actually took the time to look the functions up in msdn and they
appear to be what you are looking for. VirtualAlloc allows you to
allocate a buffer directly in virtual memory and VirtualFree from says
it releases and then decommits the memory. This would have the
appearance of increasing the size of your program while you were using
the virtual buffer then shrinking back down when you are finished with
it. If all you are concerned about is the appearance of memory use to
your users this is a solution.

The only reason I can think of that this "wouldn't work" is if you were
reading those huge files in and out of memory as the application is
running, which I'm hoping isn't the case as that would be extremely
wasteful.

> I asked how it was done and the reply was that there was no
> such APIs, (or at least the ones that do exists don't do the job we are lead
> to believe).

There was a reply, that was a link to an article that explained EXACTLY
how these "memory optimizers" work, which is exactly how Joe also
explained it. They work by allocating a huge amount of memory which
causes every other programs allocated memory to get paged to the swap
file which increases the "available" memory indicator in windows. You
know, until a program start using those pages and they eventually get
paged back into physical memory. Eventually it hits a threshold and
forces everything to the swap again. The performance results of that
are pretty obvious.

.



Relevant Pages

  • Re: VirtualAlloc()
    ... large/global memory usage instead of "new". ... allocate physical storage. ... uses `VirtualAlloc'. ...
    (microsoft.public.vc.language)
  • Re: Application becomes slow in windows server 2003
    ... Memory allocation is not your bottleneck. ... I asked the difference between heapalloc and virtualalloc because of my ... Since calloc,malloc call heapalloc so i thought to use it directly. ... assumption was it will improve performance(time to allocate memory). ...
    (microsoft.public.vc.mfc)
  • Re: abnormal OOM killer message
    ... I have got a log message with OOM below. ... one last chance is given to allocate memory before OOM routine is executed. ... Total swap = 81916kB ...
    (Linux-Kernel)
  • Re: abnormal OOM killer message
    ... I have got a log message with OOM below. ... one last chance is given to allocate memory before OOM routine is executed. ... Total swap = 81916kB ...
    (Linux-Kernel)
  • Re: Simple script that locks up my box with recent kernels
    ... Does it happen if you just do some simple "use all memory" script, ... It _used_ to be true that we were pretty good at making swap be ... just allocate backing store for the pages), ... does not work at all after a lockup, ...
    (Linux-Kernel)