Well of course it's worth taking a look, that's what I go on to say.  As
I said, I've *known* apps stop/start services like that, but that's just
an observation, not a recommendation. And there's a certain amount of
tongue-in-cheek in my remark that looks like it was missed. Anyone
looking for an API to release unneeded leaked memory or handles is not
going to find anything more practical than ExitProcess. Seriously...
;=)  

In defense of a case I saw, I'd add that stop/start the service was a
temporary solution that worked very well because the alternative was to
crash a limited memory embedded XP system once a week. A fix to stop and
start the service every few days was an easy QFE that prevented a great
deal of customer grief until the leaks were all identified, especially
when testing that the leaks are gone takes at least a week of runtime. 

Phil Wilson 


-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Greg Young
Sent: Thursday, September 06, 2007 11:38 AM
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] l immediately release any unneeded memory

> The API you need is called ExitProcess......   Seriously, I have known
> of apps where services are periodically shut down because of growing
> memory usage.  Whether this will work in your situation is something
> you'll have to look at.

Don't you think it would be worth taking a look at whats going on in
SOS before taking such hacky and non-productive measures? Its at the
least worth finding out if there *is* actually a memory leak no?

Cheers,

Greg

On 9/6/07, Wilson, Phil <[EMAIL PROTECTED]> wrote:
> The API you need is called ExitProcess......   Seriously, I have known
> of apps where services are periodically shut down because of growing
> memory usage.  Whether this will work in your situation is something
> you'll have to look at.
>
> Doing everything right in .NET doesn't necessarily help. If you search
> Help & Support for "memory leak" you'll find plenty of hits on leaks
in
> the underlying OS components (sometimes the framework), and if you're
> unlucky your service is inadvertently running into them.  You first
need
> to find out if what they're seeing is actually a leak, and then try to
> identify it from the .NET angle and maybe from the process angle if
you
> can't identify something like leaked (unmanaged) resources in your
code.
>
>
> It's not clear to me how the managed heaps inside a process are
handled.
> More memory will be allocated as more objects get created, so managed
> heap size will increase, and so will the memory used by the process.
> Even if objects are released, does the memory used by managed heaps
get
> freed? I suspect that reducing the size of a managed heap is a rare
> occurrence on a system with plenty of free memory, so the process
> statistics might be showing that a lot of memory is being used, but a
> large part of that memory might be managed heaps that aren't being
fully
> used for managed objects. Perhaps peaks in managed memory usage cause
> managed heaps to grow larger but the actual heaps aren't reduced in
size
> when objects are released, especially when there's no memory pressure
on
> the system.
>
> There's this:
http://blogs.msdn.com/ricom/archive/2004/12/10/279612.aspx
>
>
> Ironically, this: http://support.microsoft.com/kb/923299
>
>
> Phil Wilson
>
>
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Ding
> Sent: Wednesday, September 05, 2007 10:17 AM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] l immediately release any unneeded
memory
>
> Q: Why do you want to do it yourself?
>
> A: One customer noticed service process had a large number of pages in
> use and worried about a memory leak.
>
>
> Sincerely,
>
> Tracy Ding
>
>
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Patrick
Steele
> Sent: Wednesday, September 05, 2007 9:40 AM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: Re: [ADVANCED-DOTNET] l immediately release any unneeded
memory
>
> No.  The garbage collector handles that for you.  If you're utilizing
> unmanaged resources (files handles, windows handles, etc...),
implement
> the IDisposable interface to make sure you release the resources.
>
> Why do you want to do it yourself?
>
> ---
> Patrick Steele
> http://weblogs.asp.net/psteele
>
>
> -----Original Message-----
> From: Discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED] On Behalf Of Tracy Ding
> Sent: Wednesday, September 05, 2007 12:35 PM
> To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
> Subject: [ADVANCED-DOTNET] l immediately release any unneeded memory
>
>
> Is there some sort of .NET call that will immediately release any
> unneeded memory for service process?
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com
>
> ===================================
> This list is hosted by DevelopMentor(r)  http://www.develop.com
>
> View archives and manage your subscription(s) at
http://discuss.develop.com
>


--
Studying for the Turing test

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to