Hello everyone,
I got a problem about GC when creating large fields (some MB), set reference
to null and call GC.Collect. Not all virtual mem is released. Situation
improved in .net 1.1 but not in a full satisfying way.
Has anyone a solution to handle large object in safe code?
(Unsafe mem management works, but has serious disadvantages on
serialization.)
Thanks in advance 3 4399
Hi Winston
Objects in the large object heap are put in generation 2, so if you want to
force a collection of large objects, make sure you run Collect with no
parameters, or with GC.MaxGeneration as a parameter.
The CLR uses memory internally, so even though you've just run GC.Collect,
there is some memory not considered garbage that the runtime uses.
For example, if you write an app, and all it does is print
GC.GetTotalMemory to the console twice, then GC.Collect, then
GetTotalmemory again, you'll notice memory not freed.
Hope that helps
-Chris
-------------------- From: "WinstonSmith" <ma***********@gmx.de> Subject: GC does not release mem of large objects completly Date: Tue, 29 Jul 2003 17:46:27 +0200 Lines: 13 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <uf**************@TK2MSFTNGP12.phx.gbl> Newsgroups: microsoft.public.dotnet.general NNTP-Posting-Host: lighttrans.tip-jena.de 217.17.193.199 Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP12.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:102716 X-Tomcat-NG: microsoft.public.dotnet.general
Hello everyone,
I got a problem about GC when creating large fields (some MB), set
referenceto null and call GC.Collect. Not all virtual mem is released. Situation improved in .net 1.1 but not in a full satisfying way.
Has anyone a solution to handle large object in safe code? (Unsafe mem management works, but has serious disadvantages on serialization.)
Thanks in advance
--
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.
Chris,
As far as I know large objects (>85K - CLR v1.1) are directly stored in the large object heap not the Gen2 heap.
The problem with the large object heap is that while he can get collected, he never gets compacted.
Allocations require contiguous blocks of memory, when the allocation scheme is irregular, allocated memory tend to grow, this seems
to be one of the problems the GC can't handle yet.
Willy.
"Chris Lyon [MSFT]" wrote:
|| Hi Winston
||
|| Objects in the large object heap are put in generation 2, so if you
|| want to force a collection of large objects, make sure you run
|| Collect with no parameters, or with GC.MaxGeneration as a parameter.
||
|| The CLR uses memory internally, so even though you've just run
|| GC.Collect, there is some memory not considered garbage that the
|| runtime uses.
||
|| For example, if you write an app, and all it does is print
|| GC.GetTotalMemory to the console twice, then GC.Collect, then
|| GetTotalmemory again, you'll notice memory not freed.
||
|| Hope that helps
|| -Chris
||
Hi Willy,
That's right. I guess I wasn't clear in my response. Large objects are in the large object heap, but are only collected at the same time as gen 2.
You are correct, the large object heap does not get compacted.
Matthias, this is not a flaw in the GC, rather a tradeoff, since the performance hit for compacting large allocations outweighs the benefit of coniguous blocks.
Hope that's clearer :)
-Chris
-------------------- From: "WinstonSmith" <ma***********@gmx.de> References: <uf**************@TK2MSFTNGP12.phx.gbl> <Lu**************@cpmsftngxa06.phx.gbl> <ee**************@tk2msftngp13.phx.gbl> Subject: Re: GC does not release mem of large objects completly Date: Thu, 31 Jul 2003 10:04:19 +0200 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Message-ID: <#x**************@TK2MSFTNGP09.phx.gbl> Newsgroups: microsoft.public.dotnet.general NNTP-Posting-Host: lighttrans.tip-jena.de 217.17.193.199 Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.general:102963 X-Tomcat-NG: microsoft.public.dotnet.general
Thank you for your help... So its an design flaw of .net? Does anyone know, if it's going to be fixed in later releases?
Matthias
"Willy Denoyette [MVP]" <wi*************@skynet.be> schrieb im Newsbeitrag news:ee**************@tk2msftngp13.phx.gbl... Chris,
As far as I know large objects (>85K - CLR v1.1) are directly stored in the large object heap not the Gen2 heap. The problem with the large object heap is that while he can get collected, he never gets compacted. Allocations require contiguous blocks of memory, when the allocation scheme is irregular, allocated memory tend to grow, this seems to be one of the problems the GC can't handle yet.
Willy.
"Chris Lyon [MSFT]" wrote: || Hi Winston || || Objects in the large object heap are put in generation 2, so if you || want to force a collection of large objects, make sure you run || Collect with no parameters, or with GC.MaxGeneration as a parameter. || || The CLR uses memory internally, so even though you've just run || GC.Collect, there is some memory not considered garbage that the || runtime uses. || || For example, if you write an app, and all it does is print || GC.GetTotalMemory to the console twice, then GC.Collect, then || GetTotalmemory again, you'll notice memory not freed. || || Hope that helps || -Chris ||
--
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 thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Christian Seberino |
last post by:
How does Ruby compare to Python?? How good is DESIGN of Ruby compared to Python?
Python's design is godly. I'm wondering if Ruby's is godly too.
I've heard it has solid OOP design but then...
|
by: _BNC |
last post by:
Well, it started as a series of tools for supporting a project, but I've
got a large number of project directories with .SLN files that are used
by a rapidly-growing EXE.
First question: What...
|
by: Dirk Försterling |
last post by:
Hi all,
a few days ago, I upgraded from PostgreSQL 7.2.1 to 7.4, following
the instructions in the INSTALL file, including dump and restore.
All this worked fine without any error (message).
...
|
by: Jason Huang |
last post by:
Hi,
Would someone explain the following coding more detail for me? What's the
( ) for?
CurrentText = (TextBox)e.Item.Cells.Controls;
Thanks.
Jason
|
by: Frank Rizzo |
last post by:
I understand the basic premise: when the object is out of scope or has
been set to null (given that there are no funky finalizers), executing
GC.Collect will clean up your resources.
So I have...
|
by: WinstonSmith |
last post by:
Hello everyone,
I got a problem about GC when creating large fields (some MB), set reference
to null and call GC.Collect. Not all virtual mem is released. Situation
improved in .net 1.1 but not...
|
by: active |
last post by:
In the main program I check to see if a certain form has been disposed.
Does it make sense in that form's FormClosed event to do:
Me.Dispose to make sure it is disposed the next time I check.
Or...
|
by: johnxhc |
last post by:
We have a project in .NET 1.1 , some of the .NET methods take COM
interface reference pointer as a parameter, somehow we have to call
Marshal.ReleaseComObject to release the COM Object, otherwise...
|
by: Angus |
last post by:
I have a socket class CTestClientSocket which I am using to simulate
load testing.
I create multiple instances of the client like this:
for (int i = 0; i < 5; i++)
{
CTestClientSocket* pTemp...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
| |