Thursday, February 16, 2006 3:38 PM
I'm getting always an OutOfMemoryException after my program runs for a while. It's a smartphone application running on .NET 2.0 CF and using the SQL Server Mobile 2005. Sometimes it's even not a OutOfMemoryException but a SqlCeException. But it's always when the phone is having little free memory left.
I have also created a few custom controls (I even implemented the Disposable interface) to dispose all resources (Fonts, Bitmaps). I'm using all Pens and Brushes always in "using" blocks, to have them disposed immediately after having used them. The program does not have any static objects or lists of objects that are hold in memory for a long time.
I really don't understand why I get this exception. I see it always happen after doing a lot queries on the SQL Server Mobile. Is this tool using a lot memory? Can I flush somehow the memory of the SQL Server? Should I run also manually sometimes the GarbageCollector? Does this thing not run automatically?
Can anybody, perhaps of MSFT help me? I'm also willing to share the full source code with MSFT, if required.
Friday, February 17, 2006 2:04 AM
You will probably get a faster answer on the Sql Server Mobile forum.
Moving this thread to that forum.
Friday, February 17, 2006 2:08 AM
Here are a few suggestions (from an earlier thread)
1) Try to use SqlCeResultSet than DataSet
2) Please dispose the managed objects explicitly instead of waiting for garbage collector to pick them up. Please also note that SqlCeCommand object can be reused and they need to be disposed explicitly
In addtion you can email me your project and I'll be glad to look into this issue for you.
Mark dot Ihimoyan at microsoft dot com