I have tried everything to make .NET return memory to the OS. I use Dispose
and GC.Collect() as much as possible. I understand that if the memory is
available then why not take it and keep it. However, I noticed that memory
is only returned to the OS when the machine is desperate for RAM, but at
that point it is way too late, the OS is swapping and everything becomes
very slow. The other case where memory is returned to the OS is when I
minimize the application. According to Microsoft Documentation, the process
working size is trimmed, causing memory to be cashed or to be returned to
the OS.
Don't get me wrong, I understand that .NET is like an OS and needs to manage
its own heaps and that is not cheap by any means. But! For the love of God,
my little windows application with an Access connection is just consuming
more and more memory every time I click on a new option. On average, it
starts with 20M and can grow to 40M. Nothing, except minimizing the
application seems to work. This can not be acceptable, am I the only one
that noticed this? 6 1165
Did you try
myObject = null;
Thanks.
Nasser. -----Original Message----- I have tried everything to make .NET return memory to
the OS. I use Disposeand GC.Collect() as much as possible. I understand that
if the memory isavailable then why not take it and keep it. However, I
noticed that memoryis only returned to the OS when the machine is desperate
for RAM, but atthat point it is way too late, the OS is swapping and
everything becomesvery slow. The other case where memory is returned to
the OS is when Iminimize the application. According to Microsoft
Documentation, the processworking size is trimmed, causing memory to be cashed or
to be returned tothe OS. Don't get me wrong, I understand that .NET is like an OS
and needs to manageits own heaps and that is not cheap by any means. But!
For the love of God,my little windows application with an Access connection
is just consumingmore and more memory every time I click on a new option.
On average, itstarts with 20M and can grow to 40M. Nothing, except
minimizing theapplication seems to work. This can not be acceptable,
am I the only onethat noticed this?
.
Yes. I even use a reference counting program to make sure there are no
unused references...
"Nasser" <an*******@discussions.microsoft.com> wrote in message
news:06****************************@phx.gbl... Did you try
myObject = null;
Thanks. Nasser.
-----Original Message----- I have tried everything to make .NET return memory to the OS. I use Disposeand GC.Collect() as much as possible. I understand that if the memory isavailable then why not take it and keep it. However, I noticed that memoryis only returned to the OS when the machine is desperate for RAM, but atthat point it is way too late, the OS is swapping and everything becomesvery slow. The other case where memory is returned to the OS is when Iminimize the application. According to Microsoft Documentation, the processworking size is trimmed, causing memory to be cashed or to be returned tothe OS. Don't get me wrong, I understand that .NET is like an OS and needs to manageits own heaps and that is not cheap by any means. But! For the love of God,my little windows application with an Access connection is just consumingmore and more memory every time I click on a new option. On average, itstarts with 20M and can grow to 40M. Nothing, except minimizing theapplication seems to work. This can not be acceptable, am I the only onethat noticed this?
.
You could try forcing the garbage collector to run at
specific times by calling
void GC.Collect method. -----Original Message----- Yes. I even use a reference counting program to make sure
there are nounused references...
"Nasser" <an*******@discussions.microsoft.com> wrote in
messagenews:06****************************@phx.gbl... Did you try
myObject = null;
Thanks. Nasser.
>-----Original Message----- >I have tried everything to make .NET return memory to the OS. I use Dispose >and GC.Collect() as much as possible. I understand that if the memory is >available then why not take it and keep it. However, I noticed that memory >is only returned to the OS when the machine is
desperate for RAM, but at >that point it is way too late, the OS is swapping and everything becomes >very slow. The other case where memory is returned to the OS is when I >minimize the application. According to Microsoft Documentation, the process >working size is trimmed, causing memory to be cashed or to be returned to >the OS. > > > >Don't get me wrong, I understand that .NET is like an
OS and needs to manage >its own heaps and that is not cheap by any means. But! For the love of God, >my little windows application with an Access connection is just consuming >more and more memory every time I click on a new
option. On average, it >starts with 20M and can grow to 40M. Nothing, except minimizing the >application seems to work. This can not be acceptable, am I the only one >that noticed this? > > >. >
.
I'm optimistically assuming that your newsgroup server has lost the original
post, because the poster clearly stated that he had tried that (among other
things)
If that IS the case, you should probably be using Microsoft's news servers
for these newsgroups, as they keep messages around for quite a while. Just
some (hopefully) helpful advice...I'm on Time Warner and their news severs
are TERRIBLE, and moving to Microsoft's for their newsgroups helped out
enormously.
If that's NOT the case, then I guess we'll have to forgive you (this time).
"Charles" <a@b.c> wrote in message
news:0a****************************@phx.gbl... You could try forcing the garbage collector to run at specific times by calling void GC.Collect method.
-----Original Message----- Yes. I even use a reference counting program to make sure there are nounused references...
"Nasser" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl... Did you try
myObject = null;
Thanks. Nasser.
>-----Original Message----- >I have tried everything to make .NET return memory to the OS. I use Dispose >and GC.Collect() as much as possible. I understand that if the memory is >available then why not take it and keep it. However, I noticed that memory >is only returned to the OS when the machine is desperate for RAM, but at >that point it is way too late, the OS is swapping and everything becomes >very slow. The other case where memory is returned to the OS is when I >minimize the application. According to Microsoft Documentation, the process >working size is trimmed, causing memory to be cashed or to be returned to >the OS. > > > >Don't get me wrong, I understand that .NET is like an OS and needs to manage >its own heaps and that is not cheap by any means. But! For the love of God, >my little windows application with an Access connection is just consuming >more and more memory every time I click on a new option. On average, it >starts with 20M and can grow to 40M. Nothing, except minimizing the >application seems to work. This can not be acceptable, am I the only one >that noticed this? > > >. >
.
Please do not call GC.Collect() in the hope that you will benefit either
memory management or your applications performance - you won't - you will
in fact cripple it. The GC is self tuning and will optimise memory
collection based on the applications memory usage and requirements.
Calling GC.Collect() yourself may even contribute to the high memory usage,
believe it or not! Rule of thumb - *never* call GC.Collect(). Not quite
sure what you mean by a reference counting program - .NET does not use
reference counting for its memory management.
Note that the memory usage indicated by the application is not real used
memory, it is memory the CLR has provisionally allocated for use in a
contiguous block, and which it will readily release back to the OS if it
becomes short, as much of this memory is unused. On a workstation the GC
will allow memory to be consumed (more than the server model for
multi-processor boxes) to keep the user experience better by not
interrupting the application so much, but will collect if the OS runs short.
Cheers,
Greg
This posting is provided "AS IS"with no warranties, and confers no rights.
Have you tried:
SetProcessWorkingSetSize(Process.GetCurrentProcess .Handle.ToInt32, -1, -1)
"Charles" <a@b.c> wrote in message
news:0a****************************@phx.gbl... You could try forcing the garbage collector to run at specific times by calling void GC.Collect method.
-----Original Message----- Yes. I even use a reference counting program to make sure there are nounused references...
"Nasser" <an*******@discussions.microsoft.com> wrote in messagenews:06****************************@phx.gbl... Did you try
myObject = null;
Thanks. Nasser.
>-----Original Message----- >I have tried everything to make .NET return memory to the OS. I use Dispose >and GC.Collect() as much as possible. I understand that if the memory is >available then why not take it and keep it. However, I noticed that memory >is only returned to the OS when the machine is desperate for RAM, but at >that point it is way too late, the OS is swapping and everything becomes >very slow. The other case where memory is returned to the OS is when I >minimize the application. According to Microsoft Documentation, the process >working size is trimmed, causing memory to be cashed or to be returned to >the OS. > > > >Don't get me wrong, I understand that .NET is like an OS and needs to manage >its own heaps and that is not cheap by any means. But! For the love of God, >my little windows application with an Access connection is just consuming >more and more memory every time I click on a new option. On average, it >starts with 20M and can grow to 40M. Nothing, except minimizing the >application seems to work. This can not be acceptable, am I the only one >that noticed this? > > >. >
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: William C. White |
last post by:
Does anyone know of a way to use PHP /w Authorize.net AIM without using
cURL? Our website is hosted on a shared drive and the webhost company
doesn't installed additional software (such as cURL)...
|
by: Albert Ahtenberg |
last post by:
Hello,
I don't know if it is only me but I was sure that header("Location:url")
redirects the browser instantly to URL, or at least stops the execution of
the code. But appearantely it continues...
|
by: James |
last post by:
Hi,
I have a form with 2 fields.
'A'
'B'
The user completes one of the fields and the form is submitted.
On the results page I want to run a query, but this will change
subject to which...
|
by: Ollivier Robert |
last post by:
Hello,
I'm trying to link PHP with Oracle 9.2.0/OCI8 with gcc 3.2.3 on a Solaris9
system. The link succeeds but everytime I try to run php, I get a SEGV from
inside the libcnltsh.so library.
...
|
by: Richard Galli |
last post by:
I want viewers to compare state laws on a single subject.
Imagine a three-column table with a drop-down box on the top. A viewer
selects a state from the list, and that state's text fills the...
|
by: Albert Ahtenberg |
last post by:
Hello,
I have two questions.
1. When the user presses the back button and returns to a form he filled
the form is reseted. How do I leave there the values he inserted?
2. When the...
|
by: inderjit S Gabrie |
last post by:
Hi all
Here is the scenerio ...is it possibly to do this...
i am getting valid course dates output on to a web which i have designed
....all is okay so far , look at the following web url
...
|
by: Jack |
last post by:
Hi All,
What is the PHP equivilent of Oracle bind variables in a SQL statement, e.g.
select x from y where z=:parameter
Which in asp/jsp would be followed by some statements to bind a value...
|
by: Sandwick |
last post by:
I am trying to change the size of a drawing so they are all 3x3.
the script below is what i was trying to use to cut it in half ... I
get errors.
I can display the normal picture but not the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |