Re: Memory leak in BinaryFormatter?
From: Justin Rogers (Justin_at_games4dotnet.com)
Date: 11/21/04
- Next message: Justin Rogers: "Re: Memory Leak on a pure managed application"
- Previous message: jamal_at_docUSA.com: "Re: Question on Garbage Collection"
- In reply to: Martin Lessard: "Memory leak in BinaryFormatter?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 21 Nov 2004 13:51:19 -0800
You can force the GC to collect. Your issue here is that the Serialization
engine is doing
a lot of work to serialize something large like a data set. Not to mention you
don't talk
about where you store the formatted serialized data... If you are writing out to
a disk file
then you probably won't reach epic memory consumption, but writing into memory
you
just might. Remember that:
1. All types names and assembly names get formatted into the serialized data.
2. Every string becomes +1-5 bytes for an appended length.
4. Certain things appear to be aligned on certain boundaries.
As for the overhead of the serialization engine, a bit of reflection is being
used, they are
still storing the final as XML and not real blitted types, they are storing a
schema and
a diff gram, and they are estimating the system of the string builder, so if
they estimate
a large size to begin with, and then have to grow one or more times, you end up
with
a lot of wasted memory.
-- Justin Rogers DigiTec Web Consultants, LLC. Blog: http://weblogs.asp.net/justin_rogers "Martin Lessard" <Martin Lessard@discussions.microsoft.com> wrote in message news:EF6A6790-515D-4CB3-A683-03BA0B7540C2@microsoft.com... >I try to serialize a dataset with the BinaryFormatter. The size of the > dataset is about 23mb. When i call the serialise method of the > BinaryFormatter, the memory used by my process goes from 51500k to 256736k as > reported by the task manager and there is nothing i can do to reclaim this > memory. Is there a memory leak in this method?
- Next message: Justin Rogers: "Re: Memory Leak on a pure managed application"
- Previous message: jamal_at_docUSA.com: "Re: Question on Garbage Collection"
- In reply to: Martin Lessard: "Memory leak in BinaryFormatter?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|