473,473 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can I abandon the lock on .SyncRoot and lock a collection directly? Less available memory in 2.0?

DC
Hi,

I am porting an app from Framework 1.1 to 2.0 and I am now using
Dictionary objects instead of Hashtables. There are some

lock (theHashtable.SyncRoot)

statements in the 1.1 code and I replaced those by

lock (theDictionary)

statements. I did not note a difference, but I wanted to ask if this
generates any issues like more granular locking.

I swapped out the Hashtable in the first place because I was hoping
that this would safe some memory. I am observing the following: under
1.1, my app is using p to 1300 MB of memory and running fine. With
2.0, the app is now using about 1100 MB of memory and then starts
throwing "out of memory" exceptions (2GB RAM Windows 2003 machines). I
have not found a way to solve this by cofiguration, and I am therefore
trying to save RAM now. Can someone recommend a really easy method to
profile which objects use what amount of RAM?

TIA for any hints,

Regards
DC

Apr 6 '07 #1
4 1496
Hi DC,

Try running this program, but with a much smaller data set -- it adds a lot
of overhead.

ClrProfiler:
http://www.microsoft.com/downloads/d...6-862B40AA0CD0

Log dumper for ClrProfiler logs:
http://blogs.msdn.com/ricom/articles/449244.aspx
Regards,
Frank Hileman

check out VG.net: http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor

"DC" <dc@upsize.dewrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
Hi,

I am porting an app from Framework 1.1 to 2.0 and I am now using
Dictionary objects instead of Hashtables. There are some

lock (theHashtable.SyncRoot)

statements in the 1.1 code and I replaced those by

lock (theDictionary)

statements. I did not note a difference, but I wanted to ask if this
generates any issues like more granular locking.

I swapped out the Hashtable in the first place because I was hoping
that this would safe some memory. I am observing the following: under
1.1, my app is using p to 1300 MB of memory and running fine. With
2.0, the app is now using about 1100 MB of memory and then starts
throwing "out of memory" exceptions (2GB RAM Windows 2003 machines). I
have not found a way to solve this by cofiguration, and I am therefore
trying to save RAM now. Can someone recommend a really easy method to
profile which objects use what amount of RAM?

TIA for any hints,

Regards
DC

Apr 6 '07 #2
DC
On 6 Apr., 14:47, "Frank Hileman"
<frank...@no.spamming.prodigesoftware.comwrote:
Hi DC,

Try running this program, but with a much smaller data set -- it adds a lot
of overhead.

ClrProfiler:http://www.microsoft.com/downloads/d...d=A362781C-387...

Log dumper for ClrProfiler logs:http://blogs.msdn.com/ricom/articles/449244.aspx

Regards,
Frank Hileman

check out VG.net:http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor

"DC" <d...@upsize.dewrote in message

news:11**********************@y80g2000hsf.googlegr oups.com...
Hi,
I am porting an app from Framework 1.1 to 2.0 and I am now using
Dictionary objects instead of Hashtables. There are some
lock (theHashtable.SyncRoot)
statements in the 1.1 code and I replaced those by
lock (theDictionary)
statements. I did not note a difference, but I wanted to ask if this
generates any issues like more granular locking.
I swapped out the Hashtable in the first place because I was hoping
that this would safe some memory. I am observing the following: under
1.1, my app is using p to 1300 MB of memory and running fine. With
2.0, the app is now using about 1100 MB of memory and then starts
throwing "out of memory" exceptions (2GB RAM Windows 2003 machines). I
have not found a way to solve this by cofiguration, and I am therefore
trying to save RAM now. Can someone recommend a really easy method to
profile which objects use what amount of RAM?
TIA for any hints,
Regards
DC- Zitierten Text ausblenden -

- Zitierten Text anzeigen -
Thank you for the pointers, Frank. I am currently checking out CLR
Profiler.

Regards
DC

Apr 11 '07 #3
DC
On 6 Apr., 14:47, "Frank Hileman"
<frank...@no.spamming.prodigesoftware.comwrote:
Hi DC,

Try running this program, but with a much smaller data set -- it adds a lot
of overhead.

ClrProfiler:http://www.microsoft.com/downloads/d...d=A362781C-387...

Log dumper for ClrProfiler logs:http://blogs.msdn.com/ricom/articles/449244.aspx

Regards,
Frank Hileman

check out VG.net:http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor

"DC" <d...@upsize.dewrote in message

news:11**********************@y80g2000hsf.googlegr oups.com...
Hi,
I am porting an app from Framework 1.1 to 2.0 and I am now using
Dictionary objects instead of Hashtables. There are some
lock (theHashtable.SyncRoot)
statements in the 1.1 code and I replaced those by
lock (theDictionary)
statements. I did not note a difference, but I wanted to ask if this
generates any issues like more granular locking.
I swapped out the Hashtable in the first place because I was hoping
that this would safe some memory. I am observing the following: under
1.1, my app is using p to 1300 MB of memory and running fine. With
2.0, the app is now using about 1100 MB of memory and then starts
throwing "out of memory" exceptions (2GB RAM Windows 2003 machines). I
have not found a way to solve this by cofiguration, and I am therefore
trying to save RAM now. Can someone recommend a really easy method to
profile which objects use what amount of RAM?
TIA for any hints,
Regards
DC- Zitierten Text ausblenden -

- Zitierten Text anzeigen -
I tried CLR Profiler. It does - of course - bog down the system
heavily and builds a 10GB or so trace file rather quickly. It then
takes quiet a while to create graphs from that and I am frankly not
expert enough to interpret what I get then. I get the accumulated size
of all strings and stuff like that.

What I need is a simple way to periodically dump out the total size of
some objects. E.g. I need to know how fast a certain instance of a
dictionary grows.

I am now trying .Net Memory Profiler 3.0 but maybe someone knows a
simple way to get some object sizes; or has designed a routine that
iterates through a collection and sums up the sizes of all objects
contained therein.

Regards
DC

Apr 13 '07 #4
DC
Hi,

I finally fixed the problem. ".Net Memory Profiler" was a beeze to use
and helped to locate the problem quickly.

I was using a class derived from streamwriter. The streamwriter was
always constructed with a 2MB buffer. In Framework 1.1 the garbage
collector disposed those objects correctly. In Framework 2.0 I could
see those objects pile up forever.

I then modified the code and now the class does not derive from
streamwriter anymore. Instead I am simply using a textwriter as a
field of my class to write data.

Thanks again, Regards
DC

On 13 Apr., 18:56, "DC" <d...@upsize.dewrote:
On 6 Apr., 14:47, "Frank Hileman"

<frank...@no.spamming.prodigesoftware.comwrote:
Hi DC,
Try running this program, but with a much smaller data set -- it adds a lot
of overhead.
ClrProfiler:http://www.microsoft.com/downloads/d...d=A362781C-387...
Log dumper for ClrProfiler logs:http://blogs.msdn.com/ricom/articles/449244.aspx
Regards,
Frank Hileman
check out VG.net:http://www.vgdotnet.com
Animated vector graphics system
Integrated Visual Studio graphics editor
"DC" <d...@upsize.dewrote in message
news:11**********************@y80g2000hsf.googlegr oups.com...
Hi,
I am porting an app from Framework 1.1 to 2.0 and I am now using
Dictionary objects instead of Hashtables. There are some
lock (theHashtable.SyncRoot)
statements in the 1.1 code and I replaced those by
lock (theDictionary)
statements. I did not note a difference, but I wanted to ask if this
generates any issues like more granular locking.
I swapped out the Hashtable in the first place because I was hoping
that this would safe somememory. I am observing the following: under
1.1, my app is using p to 1300 MB ofmemoryand running fine. With
2.0, the app is now using about 1100 MB ofmemoryand then starts
throwing "out ofmemory" exceptions (2GB RAM Windows 2003 machines). I
have not found a way to solve this by cofiguration, and I am therefore
trying to save RAM now. Can someone recommend a really easy method to
profile which objects use what amount of RAM?
TIA for any hints,
Regards
DC- Zitierten Text ausblenden -
- Zitierten Text anzeigen -

I tried CLR Profiler. It does - of course - bog down the system
heavily and builds a 10GB or so trace file rather quickly. It then
takes quiet a while to create graphs from that and I am frankly not
expert enough to interpret what I get then. I get the accumulated size
of all strings and stuff like that.

What I need is a simple way to periodically dump out the total size of
some objects. E.g. I need to know how fast a certain instance of a
dictionary grows.

I am now trying .NetMemoryProfiler 3.0 but maybe someone knows a
simple way to get some object sizes; or has designed a routine that
iterates through a collection and sums up the sizes of all objects
contained therein.

Regards
DC- Zitierten Text ausblenden -

- Zitierten Text anzeigen -

Apr 19 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rich Sienkiewicz | last post by:
Some classes, like Queue and SortedList, have a Synchronized method which gives a thread safe wrapper object for these classes. But the lock() statement does the same thing. Is there any rules as to...
4
by: memememe | last post by:
in java if I was calling a synchronized block and wanted to sync it even for static blocks of code I could do a synchronize(theObject.getClass()), can I do a lock(theObject.GetType()) on C# and...
7
by: Derrick | last post by:
I'm loading a boatload of data into a DataSet. The memory usage grows and grows for the app while loading that data. Calling GC.Collect() reduces the consumption slightly. When I minimize the...
14
by: Sharon | last post by:
Hi all. I have an ArrayList and sometimes while enumerating through, i get an exception because another thread has added to the ArrayList. To solve this problem, i lock the enumeration, passing...
1
by: Mike McDonald | last post by:
I am trying to free up some memory by forcing a session.clear and a session.abandon. When I startup the application, it starts at about 80,000 KB of memory in the aspnet_wp.exe. I am able to...
5
by: Jacob | last post by:
Hi there, Say I have an ArrayList named list. What's the difference between using lock(list) { .... } and lock(list.SyncRoot) { .... }
4
by: Oscar Thornell | last post by:
Hi, Any comments regarding this implementation... SortedList<String, Stringlist = new SortedList<String, String>(); lock (((IList)list).SyncRoot) { foreach (Object item in list) {
158
by: pushpakulkar | last post by:
Hi all, Is garbage collection possible in C++. It doesn't come as part of language support. Is there any specific reason for the same due to the way the language is designed. Or it is...
2
by: zaferaydin | last post by:
hi, i have a class that contains an arraylist. The arraylist is accessed from many threads. These threads add an item into arraylist. In order to provide thread safety, i use lock keywork. But...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.