WTF??

  • Thread starter Thread starter CJ Taylor
  • Start date Start date
C

CJ Taylor

Ok... someone help me understand this...

Now I've been reading a couple articles on the GC in .NET and wondering why
my application is sucking up memory, I release the resources (even call
..Dispose on objects to make sure) and it wouldn't release the memory...

However, if you minimize the window (applicaiton or Visual Studio) it seems
to invoke the GC and memory is freed.

Is anyone else experiencing this? Does this mean when my app is running low
on memory I am to inform my users to "minimize and maximize"?

Any advice would be greatly appreciated, as this does seem.... I dunno...
dumb?

-CJ
 
CJ Taylor said:
Ok... someone help me understand this...

Now I've been reading a couple articles on the GC in .NET and wondering why
my application is sucking up memory, I release the resources (even call
.Dispose on objects to make sure) and it wouldn't release the memory...

However, if you minimize the window (applicaiton or Visual Studio) it seems
to invoke the GC and memory is freed.

Is anyone else experiencing this? Does this mean when my app is running low
on memory I am to inform my users to "minimize and maximize"?

Any advice would be greatly appreciated, as this does seem.... I dunno...
dumb?

-CJ

The minimise/restore behavior has nothing to do with .NET or garbage
collection - it's just the working set behavior. Try doing the same with any
other app and you'll see the same thing.

Erik
 
* "CJ Taylor said:
Now I've been reading a couple articles on the GC in .NET and wondering why
my application is sucking up memory, I release the resources (even call
.Dispose on objects to make sure) and it wouldn't release the memory...

However, if you minimize the window (applicaiton or Visual Studio) it seems
to invoke the GC and memory is freed.

Is anyone else experiencing this? Does this mean when my app is running low
on memory I am to inform my users to "minimize and maximize"?

<http://groups.google.de/[email protected]>
 
Hey Erik,

Yeah, been reading about that from a previous link. My fault for thinking
it was in the GC. Still odd behavior as far as I'm concerned... Makes me
feel kinda silly that I wasn't watching memory allocation more in my
development =(

But as far as I can tell I can set the working process size, which I won't
do until I'm done because I can see how you can have major performance
problems because of this...

*sigh*...

-CJ
 
CJ Taylor said:
yeah... saw it...

i still think its f#%&(@ up though...

=)

As a rule of thumb, it has been explained to me that trying to actively
manage memory with GC.Collect() and SetProcessWorkingSet() will impair
performance overall, rather than help. It might seem strange to see a hello
world program taking up 20 megs of memory, but this is just an indication
that the managed environment doesn't release memory until it has to.

If you load a memory hog (like Photoshop with a giant file) alongside
your .NET app, you will see that your app releases memory in a reasonable
manner, as other apps begin to need it.

Memory management in .NET works in mysterious ways.

Erik
 
yeah... saw it...
As a rule of thumb, it has been explained to me that trying to actively
manage memory with GC.Collect() and SetProcessWorkingSet() will impair
performance overall, rather than help. It might seem strange to see a hello
world program taking up 20 megs of memory, but this is just an indication
that the managed environment doesn't release memory until it has to.

I've been reading more about that. I think there is just some paranoia
coming from days of old where when you saw things like this it was obvious
signs of memory leaks. It's still diffucult getting used to things like
that though...
If you load a memory hog (like Photoshop with a giant file) alongside
your .NET app, you will see that your app releases memory in a reasonable
manner, as other apps begin to need it.

Just tested that theory... I loaded a 240 meg file in Photoshop while
running my .NET app.. went from 130meg to about 34 megs...

Weird...
Memory management in .NET works in mysterious ways.

Yes... I just want to understand how... =)

fortunalty, there was...

http://msdn.microsoft.com/library/default.asp?url=/msdnmag/issues/1100/gci/toc.asp
 
* "CJ Taylor said:
I've been reading more about that. I think there is just some paranoia
coming from days of old where when you saw things like this it was obvious
signs of memory leaks. It's still diffucult getting used to things like
that though...

Right -- it's not the 1st time I read the question you posted to the
groups. Memory usage as shown in the task manager isn't an indicator
for memory leaking/... for .NET applications.
Just tested that theory... I loaded a 240 meg file in Photoshop while
running my .NET app.. went from 130meg to about 34 megs...

Thank you for sharing the results of your tests with the group.
Nevertheless, make sure, the memory isn't only swapped to disk.
 
Hi CJ,

One of the things I did not like (when the memory was expensive) in the IBM
360 architecture was the way it managed the memory.

What is NT based on?

In my opinion has a W9x computer a better memory architecture in terms of
using as few as necessary, but as far as I know it is therefore also less
save to use.

But now it is silly to think to much on that amounts of memory we use in our
programs, because adding memory is mostly cheaper than spending to much time
on it

Just my thoughts.

Cor
 
Back
Top