'Hunting for Memory Leaks in .NET Compact Framework (WinCE 5)
I'm working with a transaction-based system on a Windows CE device under the Compact .NET Framework v3.5. What we've found is that as more-and-more transactions are performed, less-and-less memory is available. Obviously a memory-leak of some kind.
After each transaction, we take two memory readings; one from the OS (a PInvoke call), and one from the Garbage Collector. We've found that the OS reading is increasing memory usage, while the reading from the GC stays relatively stable (about a 1MB variance +-).
The application makes use of Microsoft Synchronization Services to store information on a couple of local databases (SQL Server Compact v3.5), and sync them with a remote server.
If this were Windows XP, I'd simply connect to the executable with WinDbg, and analyze the heap to see if I'm creating objects that are never getting GC'd. However, I don't even know if the managed heap is the problem.
So this question is two parts:
1) What are the likely culprits of leaking memory in this manner in a managed application (DataAdapters, Streams, etc)?
2) What debugging tools/techniques will help me track down the exact issue?
I know it isn't a lot to go on, but I don't have much more information than this, at this stage.
Thanks!
Solution 1:[1]
Sounds like you're missing an EndInvoke somewhere perhaps? Or not closing your connections?
Might not be the problem but we just had an issue similar here at my work...a couple missing EndInvoke calls were totally locking up our servers after a few days of up-time....like enough to where we had to go down and hardboot the box.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | J Benjamin |