Hi Bob,
 
It's hard to say without looking at your code, but here are some opinions of 
mine:
 
1. The GC is extremely intelligent. A memory leak in managed code will be 
because you still have a reference somewhere to memory, which the GC can't 
touch. I believe that 99 times out of 100 you're making a mistake by forcing 
the GC to clean up.
 
2. I bet it's not iBatis, Log4net or spring. Many people (including me) use 
these every day with no issues. 
 
3. Make sure you have no static fields or similar things that could be keeping 
a hold on memory.
 
Regards,
Dustin


>>> "Bob Hanson" <[EMAIL PROTECTED]> 9/6/2007 9:26 AM >>>
I don't know if this is even the proper place for me to ask these questions but 
I'm hoping others may have had a similar experience and can provide some advice.

I have a Windows Service that runs on a Windows 2000 server. It uses a system 
timer that triggers a process to run every 30 minutes. 

The process is straight forward, performing 4 separate queries with each 
returning a list of objects. Those objects are then used to perform some 
functionality which involves accessing remote web services. A majority of the 
time only 2 of the 4 queries returns any data. iBatis.Net is used for all 
database interaction. Log4Net is used for logging. Spring.Net is used during 
the object processing.

The problem I am having is that over time the Windows Service is not releasing 
memory and eventually the service will throw an out of memory exception and 
crash. The process is 100% managed code. How long it takes to run out of memory 
seems to vary but it generally takes more than 24 hours if not longer. 

I already modified the process to return a list of Ids instead of a list of 
complete objects. A list of only 100 ids would be a large list so I'm not 
dealing with a lot of data. I then query for a full object on an individual 
basis using the object id. 

I also call the garbage collector directly to try to force memory release.

At this point I don't know what to do as the problem still remains. So I'm 
wondering if anyone has seen this kind of memory problem before when using a 
Windows Service with .NET. Also does anyone know if I should focus on iBatis, 
Spring or Log4Net as the possible cause? I've read about using a .net profiler 
tool but I have to admit that I have a hard time understanding how to profile 
code. 

Thanks,
Bob

Reply via email to