aspnet_wp.exe + serialization = --resources

A

Alex D.

hi guys.
I need to clone multiple times an object and I am succesfully cloning using
the regular serialization process, using a MemoryStream. My problem is that
after cloning the object more that 7 or 10 times then my computer's memory
gets flooded by the aspnet working process, and every time I call the
Clone() method the processor
resources gets consumed 100% for like 30 seconds. And this problem increases
as the amount of clones are created increases. I read some other gu had the
same problem but he dindt post the answer.
Please help!

Thanks,
alex.

PS: below is the post from that guy..my problem is exactly the same.
==============================================================================
hi there!
I implemented a Clone()-method with BinaryFormatter and MemoryStream as
shown in this Forum-Thread!
everything was fine until now. but suddenly following problem occured:

I clone quite a complex object-structure (composite-pattern, several
collections as members ...).
I need to Clone a node-object several times and add them to the parent-node.

so far, so good - everything works, BUT:
the performance to Clone (serialize & deserialize) becomes VERY slow (> 60
sec) after calling the Clone() about 10 times.
I guess its because of following:
the MemoryStream.Length increases with FACTOR 2 after EVERY Clone()-call, no
matter how big the object was to clone!!!!!
can anybody tell me, for what reason the BinaryFormatter.Serialize()-method
writes doublicated size of datas to the MemoryStream every time I call the
Clone()-method??
is there maybe something wrong with my class-structure which i want to
clone??

thanx for help!
byckler

here my Clone()-implementation:

public virtual object Clone()
{
BinaryFormatter Formatter = new BinaryFormatter(null,
new StreamingContext(StreamingContextStates.Clone));
MemoryStream stream = new MemoryStream();
Formatter.Serialize(stream,this);
stream.Position = 0;
object clonedObj = Formatter.Deserialize(stream);
stream.Close();
return clonedObj;
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,516
Members
44,991
Latest member
Josephnag

Latest Threads

Top