Pagefile control (Virtual memory

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like some assistance on a application I am developing in vb.net 2003
that uses a large dataset to query a database. Most queires are small, and
execute with no problem. When a large query is executed and stored in the
dataset, I use the garbage collector and the setProcessWorkingSetSize()
function to remove the data from memory when it is no longer needed. This
works great for the RAM, but as far as the pagefile, it grows for every large
query and is not released untill program shutdown.

Thanks in advance.
 
That's precisely what SetProcessWorkingSetSize does, it flushes unused
pages of the application in RAM to the pagefile.

Are you running out of virtual memory because of this? If not, you
don't need to worry, when VM gets low, the GC will kick in and compact
its heap, which will reduce the size of the pagefile as well.

Regards
Senthil
 
Senthil,
Thanks for your reply. Actually I are running out of VM. That is why I am
trying to flush the VM. Any Ideas?

Thanks
 
Laurent M said:
Senthil,
Thanks for your reply. Actually I are running out of VM. That is why I
am
trying to flush the VM. Any Ideas?

Thanks
Don't use these function to reduce the WS, they aren't of any help (jeez, I
wonder why they have been included in the FCL), all you are doing in forcing
pages to be written to disk, but your problems is that you are consuming
more memory than available and I'm not talking about RAM I'm talking about
virtual address space.
A normal .NET application has something like 1.5MB free VAS, but this space
(especially the Large Object Heap) can be higly fragmented such that only a
fraction of this is available in one large chunk.
Assume the largest free block is ~ 500MB, when your Dataset grows beyond
this , you will get OOM exceptions.
So what you have to do is; check the Dataset size and reduce it by returning
fewer rows or splitting the data over more than one Dataset you name it. If
your Dataset is not that large check other objects that might stay live when
not needed, in other words measure your memory consumption using tools like
CLRProfiler and perfmon.


Willy.
 
"A normal .NET application has something like 1.5MB free VAS"

I'm sure you meant 1.5 GB :).
 
S. Senthil Kumar said:
"A normal .NET application has something like 1.5MB free VAS"

I'm sure you meant 1.5 GB :).

Eek... back to DOS age!!!!

Thanks.
Willy.
 
Back
Top