Are you seeing excessive memory usage by String instances, or are there simply a lot of strings allocated? Logging could cause a lot of allocated string instances, but it should not lead to excessive memory usage, unless there is a memory leak or if you're logging to memory.
AFAIK, there are no leaks when deserialing XML. Are you having memory problems when working with XML?
SciTech Software AB
After watching the 3rd tutorial on this site, I began beeing concerned about memory leaks, especially memory used by strings. I've got an enormous amout of memory that never seems to be freed (about half of all string instances never deallocate).
Is there any way to investigate string usage ? I wonder how could I resolve total memory alloc peaks.
Any ideas would be greatly appreciated. Thanks
To avoid unnessary memory overhead, you should try to avoid promoting instances to higher generations. This is often not very easy, but you should try to keep the life-time of instances as short as possible (as shown in Tutorial 3). Have you tried to enable the heap utilization tracker? It will help you locate methods that allocate instances that get promoted to higher generations.
You enable the heap utilization tracker using the Tools->Settings dialog. To view how the heap is utilized, you should select the "Heap utilization" classes view.
For optimal behavior, all instances should be GCed in generation #0. When the heap utilization tracker is enabled, you will also be able to collect a heap snapshot using only a gen #0 GC. After this snapshot you will be able to see how many instances that still reside on the GC heap even though they're not reachable from any root. You will also be able to identify the methods (and call stacks) that create these instances.
SciTech Software AB
And a Support entry about XmlSerialization : http://support.microsoft.com/kb/886385/en-us
Users browsing this forum: No registered users and 1 guest