PC Review


Reply
Thread Tools Rate Thread

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

 
 
DC
Guest
Posts: n/a
 
      6th Apr 2007
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

 
Reply With Quote
 
 
 
 
Frank Hileman
Guest
Posts: n/a
 
      6th Apr 2007
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
DC
Guest
Posts: n/a
 
      11th Apr 2007
On 6 Apr., 14:47, "Frank Hileman"
<frank...@no.spamming.prodigesoftware.com> wrote:
> 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.de> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > 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

 
Reply With Quote
 
DC
Guest
Posts: n/a
 
      13th Apr 2007
On 6 Apr., 14:47, "Frank Hileman"
<frank...@no.spamming.prodigesoftware.com> wrote:
> 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.de> wrote in message
>
> news:(E-Mail Removed)...
>
>
>
> > 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

 
Reply With Quote
 
DC
Guest
Posts: n/a
 
      19th Apr 2007
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.de> wrote:
> On 6 Apr., 14:47, "Frank Hileman"
>
>
>
>
>
> <frank...@no.spamming.prodigesoftware.com> wrote:
> > 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.de> wrote in message

>
> >news:(E-Mail Removed)...

>
> > > 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 -



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Scroll Lock, Num Lock and Caps Lock icons. Mel Bourne Windows XP General 3 19th Jan 2007 07:02 AM
Lock specific columns in a table when opening directly =?Utf-8?B?cXVhcnR6?= Microsoft Access VBA Modules 4 18th Oct 2006 09:25 PM
lock(list) vs. lock(list.syncroot) Jacob Microsoft C# .NET 5 15th Jul 2006 12:47 AM
CAPS LOCK SCROLL LOCK NUM LOCK Flashing JJoe Microsoft Windows 2000 Windows Updates 3 21st Mar 2006 01:14 PM
IsSynchronized false inside lock(ICollection.SyncRoot) ? anon Microsoft Dot NET Framework 1 17th Mar 2004 08:10 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:02 PM.