Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / September 2004

Tip: Looking for answers? Try searching our database.

very large object allocation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
assaf - 18 Sep 2004 20:30 GMT
hi all

i just finished reading Jeoffrey Richter's article:
http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx
according to which, 20,000 bytes object do not get shifted upon freeing
them.

so how am i suppose to deal with an application that constanly plays with
huge buffers,
20k being tiny!

no wonder my application seems to be leeking memory!

what am i supposed to do?

assaf
Imran Koradia - 18 Sep 2004 20:29 GMT
> i just finished reading Jeoffrey Richter's article:
> http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx
> according to which, 20,000 bytes object do not get shifted upon freeing
> them.
That is incorrect - the article says that objects that are greater than
20,000 bytes in size are not compacted. The GC compacts (align objects in
contiguous memory locations) objects during a garbage collection to allow
for locality of reference and hence improved performance. Compacting is not
done for larger objects since the substantial CPU time taken to move larger
objects defeats the whole purpose of compacting. As mentioned in the
article, the larger objects are finalized and freed just like all other
objects and hence that would not be the source of your memory leak.

> so how am i suppose to deal with an application that constanly plays with
> huge buffers,
> 20k being tiny!
You could use weak referencing (which is mentioned in the same article) to
improve performance. You shouldn't have problems with your applications as
such since the GC will run collections whenever Gen0, Gen1 or Gen2 heap
locations get filled up. It will also dynamically allocate more memory to
the heap when it needs to depending on the requirements of your application.
Large long-lived objects or long-lived objects that have large-sized members
would be a few sources of memory leak.

> no wonder my application seems to be leeking memory!
This is definitely not because of the GC's decision to not to compact
objects larger than 20,000 bytes. You might want to go through your code
again or maybe run a profiler to find sources of memory leaks. Take a look
at this blog post how you could do that:
http://dotnetjunkies.com/WebLog/jpalermo/archive/2004/08/18/22491.aspx

hope that helps..
Imran.
Richard Blewett [DevelopMentor] - 19 Sep 2004 14:39 GMT
Which version of the framework are you using? There was a well documented bug in 1.0 which led to memory leaks from the large object heap

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

  nntp://news.microsoft.com/microsoft.public.dotnet.framework/<uT29z9anEHA.1248@TK2MSFTNGP09.phx.gbl>

hi all

i just finished reading Jeoffrey Richter's article:
http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/default.aspx
according to which, 20,000 bytes object do not get shifted upon freeing
them.

so how am i suppose to deal with an application that constanly plays with
huge buffers,
20k being tiny!

no wonder my application seems to be leeking memory!


what am i supposed to do?


assaf





[microsoft.public.dotnet.framework]
assaf - 19 Sep 2004 21:01 GMT
hi richard.

i believe that we are using 1.1.
we are using visual studio 2003.

how can i know?

assaf

> Which version of the framework are you using? There was a well documented bug in 1.0 which led to memory leaks from the large object heap
>
[quoted text clipped - 3 lines]
>
>  http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<uT29z9anEHA.1248@TK2MSFTNGP09.phx.gbl>

>  hi all
>
[quoted text clipped - 19 lines]
>
>  [microsoft.public.dotnet.framework]
Richard Blewett [DevelopMentor] - 19 Sep 2004 20:31 GMT
Unless you have done alot of hard work to make it otherwise, you are using VS.NET2003 means 1.1

Regards

Richard Blewett - DevelopMentor

http://staff.develop.com/richardb/weblog

  nntp://news.microsoft.com/microsoft.public.dotnet.framework/<ewrS4znnEHA.2948@TK2MSFTNGP11.phx.gbl>

hi richard.

i believe that we are using 1.1.
we are using visual studio 2003.

how can i know?


assaf


"Richard Blewett [DevelopMentor]" <richardb@develop.com> wrote in message
news:OkzRi4knEHA.4084@TK2MSFTNGP10.phx.gbl...
> Which version of the framework are you using? There was a well documented
bug in 1.0 which led to memory leaks from the large object heap

> Regards
>
> Richard Blewett - DevelopMentor
>
> http://staff.develop.com/richardb/weblog

nntp://news.microsoft.com/microsoft.public.dotnet.framework/<uT29z9anEHA.1248@TK2MSFTNGP09.phx.gbl>

> hi all
>
[quoted text clipped - 19 lines]
>
> [microsoft.public.dotnet.framework]





[microsoft.public.dotnet.framework]
Willy Denoyette [MVP] - 19 Sep 2004 22:16 GMT
Note that this article is four years old and isn't correct as far as the
size of the large objects being 85Kb now.
Also don't "suppose" you have memory leaks, measure your memory consumption
using perfmon counters and/or use a memory profiler if you want to be sure.
Most "memory leaks" in .NET tend to be nothing else than the result of how
.NET:
- allocates memory for the GC heap.
- the JITter allocates memory for the jitted code.
- the assembly loader allocates memory for the IL/Metadata.
- the class loader initializes it's tables (method table, interface tables
...).

Willy.

> hi all
>
[quoted text clipped - 12 lines]
>
> assaf

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.