By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,933 Members | 1,574 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,933 IT Pros & Developers. It's quick & easy.

aspnet_wp.exe + serialization = --resources

P: n/a
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;
}

Mar 17 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
for those interested here is the answer:
http://support.microsoft.com/default...b;en-us;890929
"Alex D." <al********@hotmail.com> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
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;
}

Mar 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.