HighTechTalks DotNet Forums  

compact managed heap

Dotnet Framework (Performance) microsoft.public.dotnet.framework.performance


Discuss compact managed heap in the Dotnet Framework (Performance) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Frank Samuel
 
Posts: n/a

Default compact managed heap - 10-11-2004 , 10:14 AM






Hi,
I've got an application, which has the following performance counters:
..NET CLR Memory\# Total committed Bytes = 12 MB
..NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank



Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: compact managed heap - 10-11-2004 , 12:31 PM






Hi Frank

There a several reasons why there may be allocated unused memory. Pinned objects, for example, prevent the GC from compacting (even if you don't pin yourself, there are
some framework classes that do). Also, in v1.0 and v1.1 the large memory heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would recommend you let the GC compact when it deems it necessay, and not call GC.Collect() yourself.

Hope that helps
-Chris

--------------------

Quote:
Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank




--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.



Reply With Quote
  #3  
Old   
Sriram Krishnan
 
Posts: n/a

Default Re: compact managed heap - 10-12-2004 , 01:57 AM



How does the large object heap work in v 2.0? Is there any change?

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram


""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote

Quote:
Hi Frank

There a several reasons why there may be allocated unused memory. Pinned
objects, for example, prevent the GC from compacting (even if you don't
pin yourself, there are
some framework classes that do). Also, in v1.0 and v1.1 the large memory
heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would
recommend you let the GC compact when it deems it necessay, and not call
GC.Collect() yourself.

Hope that helps
-Chris

--------------------


Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be
compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank





--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified
at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.




Reply With Quote
  #4  
Old   
Frank Samuel
 
Posts: n/a

Default Re: compact managed heap - 10-12-2004 , 08:00 AM



Hi Chris,
thanks for this information.
In my program there are no pinned objects (according to perfmon).
The large object heap has a size of 1,3 MB.

Even a manual GC.Collect() just reduces the "Bytes in all heaps", but not
the "Total commited bytes".
The latter one is critical for me, because it directly affects the private
bytes (at least I assume this), which are critical for me.

Is there any chance to reduce the commited memory used by the CLR?

Thanks
Frank

""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote

Quote:
Hi Frank

There a several reasons why there may be allocated unused memory. Pinned
objects, for example, prevent the GC from compacting (even if you don't pin
yourself, there are
Quote:
some framework classes that do). Also, in v1.0 and v1.1 the large memory
heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would
recommend you let the GC compact when it deems it necessay, and not call
GC.Collect() yourself.
Quote:
Hope that helps
-Chris

--------------------


Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be
compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank





--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
Quote:



Reply With Quote
  #5  
Old   
AT
 
Posts: n/a

Default Re: compact managed heap - 10-12-2004 , 11:52 AM



Hi Sriram

There have been numerous improvements to the performance of the LOH, but as far as I know, nothing that involves .NET developers having to change their v1.0 or v1.1 apps.

-Chris

--------------------

Quote:
How does the large object heap work in v 2.0? Is there any change?

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram


""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote in message
news:eRJhAh7rEHA.2276 (AT) cpmsftngxa06 (DOT) phx.gbl...
Hi Frank

There a several reasons why there may be allocated unused memory. Pinned
objects, for example, prevent the GC from compacting (even if you don't
pin yourself, there are
some framework classes that do). Also, in v1.0 and v1.1 the large memory
heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would
recommend you let the GC compact when it deems it necessay, and not call
GC.Collect() yourself.

Hope that helps
-Chris

--------------------


Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be
compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank





--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified
at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.





--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.



Reply With Quote
  #6  
Old   
AT
 
Posts: n/a

Default Re: compact managed heap - 10-12-2004 , 11:56 AM



Hi Frank

For performance reasons, the large object heap does not contract, meaning if you allocated a 100MB of large objects, then the LOH will be at least 100MB, and not shrink. This
is because the GC bases its behaviour on your previous memory allocation patterns. If you allocated large memory in the past, it's cheaper to leave that amount reserved for
future allocations.

If this behaviour is causing your application problems, consider ways to avoid large memory allocaltions, for example, replace large arrays with ArrayLists, or consider pooling.

Hope that helps
-Chris

--------------------
Quote:
Hi Chris,
thanks for this information.
In my program there are no pinned objects (according to perfmon).
The large object heap has a size of 1,3 MB.

Even a manual GC.Collect() just reduces the "Bytes in all heaps", but not
the "Total commited bytes".
The latter one is critical for me, because it directly affects the private
bytes (at least I assume this), which are critical for me.

Is there any chance to reduce the commited memory used by the CLR?

Thanks
Frank

""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote in message
news:eRJhAh7rEHA.2276 (AT) cpmsftngxa06 (DOT) phx.gbl...
Hi Frank

There a several reasons why there may be allocated unused memory. Pinned
objects, for example, prevent the GC from compacting (even if you don't pin
yourself, there are
some framework classes that do). Also, in v1.0 and v1.1 the large memory
heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would
recommend you let the GC compact when it deems it necessay, and not call
GC.Collect() yourself.

Hope that helps
-Chris

--------------------


Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be
compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank





--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.





--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.



Reply With Quote
  #7  
Old   
Sriram Krishnan
 
Posts: n/a

Default Re: compact managed heap - 10-12-2004 , 12:18 PM



Yes - I just want to know whether there's anything you can tell us about
what those improvements are. I'm impatient and don't really want to wait for
Rotor v2. So if there's any publically available info, please point us to
it

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram


""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote

Quote:
Hi Sriram

There have been numerous improvements to the performance of the LOH, but
as far as I know, nothing that involves .NET developers having to change
their v1.0 or v1.1 apps.

-Chris

--------------------


How does the large object heap work in v 2.0? Is there any change?

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram


""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote in message
news:eRJhAh7rEHA.2276 (AT) cpmsftngxa06 (DOT) phx.gbl...
Hi Frank

There a several reasons why there may be allocated unused memory.
Pinned
objects, for example, prevent the GC from compacting (even if you don't
pin yourself, there are
some framework classes that do). Also, in v1.0 and v1.1 the large
memory
heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would
recommend you let the GC compact when it deems it necessay, and not call
GC.Collect() yourself.

Hope that helps
-Chris

--------------------


Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be
compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank





--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms
specified
at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.






--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified
at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.




Reply With Quote
  #8  
Old   
AT
 
Posts: n/a

Default Re: compact managed heap - 10-12-2004 , 01:54 PM



There is nothing I can specifically comment on at this time. Sorry!

-Chris

--------------------
Quote:
Yes - I just want to know whether there's anything you can tell us about
what those improvements are. I'm impatient and don't really want to wait for
Rotor v2. So if there's any publically available info, please point us to
it

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram


""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote in message
news:WjNuPvHsEHA.4016 (AT) cpmsftngxa06 (DOT) phx.gbl...
Hi Sriram

There have been numerous improvements to the performance of the LOH, but
as far as I know, nothing that involves .NET developers having to change
their v1.0 or v1.1 apps.

-Chris

--------------------


How does the large object heap work in v 2.0? Is there any change?

--
Sriram Krishnan

http://www.dotnetjunkies.com/weblog/sriram


""Chris Lyon [MSFT]"" <clyon (AT) online (DOT) microsoft.com> wrote in message
news:eRJhAh7rEHA.2276 (AT) cpmsftngxa06 (DOT) phx.gbl...
Hi Frank

There a several reasons why there may be allocated unused memory.
Pinned
objects, for example, prevent the GC from compacting (even if you don't
pin yourself, there are
some framework classes that do). Also, in v1.0 and v1.1 the large
memory
heap does not get compacted, since for performance reasons.

The GC will compact the heap when it performs a collection. I would
recommend you let the GC compact when it deems it necessay, and not call
GC.Collect() yourself.

Hope that helps
-Chris

--------------------


Hi,
I've got an application, which has the following performance counters:
.NET CLR Memory\# Total committed Bytes = 12 MB
.NET CLR Memory\# Bytes in all heaps = 2,5 MB.
This means, that about 10 MB of memory is not used, but allocated.

Due to memory limitations I would like to let the managed heap be
compacted
(e.g. by calling GC.Collect() and ???.ReleaseUnnecessayMemory()).
Is this possible?

Thx
Frank





--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms
specified
at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.






--

This posting is provided "AS IS" with no warranties, and confers no
rights. Use of included script samples are subject to the terms specified
at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.





--

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this message are best directed to the newsgroup/thread from which they originated.



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.