473,394 Members | 1,699 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

aspnet_wp.exe + serialization = --resources

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
1 983
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Andy Searls via .NET 247 | last post by:
Trying to get business objects to work as return values for webservices. The primary problem is that the business objects arelate bound, requiring interfaces for property types. I tryusing the...
0
by: Wayne Wengert | last post by:
I have a basic understanding of XML and I have a similar basic grasp of VB.NET for developing Windows applications. I am still struggling with the when/where/how in the proper use of OO classes and...
3
by: scoobydoo | last post by:
Hello, I am trying to implement ICloneable's Clone() function, using Serialization. However, my code causes an exception. I have a class derived from TreeNode called "Node1". In Node1, I...
6
by: Larry Serflaten | last post by:
Acording to Bob Powell, serializing an object should be a breeze: http://groups.google.com/groups?hl=en&lr=&safe=off&selm=%23TR3qvCcCHA.2544%40tkmsftngp11 But its not happening, and I can't see...
2
by: Peter | last post by:
Hi, If I Serialized a instance of class zCMethod and then deserialized it, no error occurs. Now ,I Serialized a instance of class InheritedCMethod and then deserialized it, I got an error....
1
by: Alex D. | last post by:
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...
2
by: Chukkalove | last post by:
I've had to change a class within an application. The previous developer used serialization to store objects to file. He didnt use ISerializable interface and even if he had..... I just dont trust...
2
by: smith4894 | last post by:
{ not sure you're aware of that but there are the newsgroups for all major operating systems. you might want to try asking in the forum 'comp.os.linux.development.apps', since memory-mapped files...
0
by: shamirza | last post by:
· When was .NET announced? Bill Gates delivered a keynote at Forum 2000, held June 22, 2000, outlining the .NET 'vision'. The July 2000 PDC had a number of sessions on .NET technology, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.