I hope that's true. I've had the same problem with my services, which are
written in C#. Mine are even worse. I have one that takes up 23 MB. It's
using Remoting, AppDomains, Threads, XML, some Reflection also, and
other things, but nothing that I'd think would occupy so much memory.
The reason I'm not so sure about your explanation is that I've tried
explicitly calling the GC (with System.GC() or something like that) and it
didn't do much. If what you say is right, wouldn't it be expectable that
an explicit call to the GC would release a probably big chunk of memory?

By the way, I've also had a case with a much simpler service that occupied
about 6 or 7 MB at the beggining of execution, but that after a while
would occupy only a few KBs. It was "sleeping" most of the time and did a
very rare periodical check. I guess the O.S. together with the GC take
care of releasing all unneeded resources.
This also suggests that .Net services have an heavy "start-up penalty".
Any thoughts on this?

Paulo Sacramento

On Wed, 30 Jul 2003, Griffiths, Ian wrote:

> .NET processes will tend to grow to what looks like an alarmingly large
> size unless there is a reason for them to shrink.  The CLR does actually
> keep track of the amount of memory being used system-wide, and if other
> processes start to demand more memory, the CLR will trigger a garbage
> collect in your process, reducing the amount of memory that it is using.
>
> So the large-looking memory consumption isn't usually an issue.  If
> anything else in the system starts to need that memory, the CLR will
> give it back.
>
> IDispose doesn't have any bearing on this.  IDispose has nothing to do
> with memory allocation, it's just about other resources.  The fact that
> your memory usage stays constant at 18MB indicates that you're not
> leaking resources.
>
> If it was forever creeping upwards, then that would be something to
> worry about.  But 18MB is fairly normal.
>
>
>

--
"We live in a society exquisitely dependent on science and technology, in
which hardly anyone knows anything about science and technology."

Carl Sagan

Reply via email to