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 / CLR / September 2005

Tip: Looking for answers? Try searching our database.

Control Managed Heap size

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Amir Shitrit - 27 Sep 2005 20:27 GMT
Hi to all.
Is there a way to control the size of the managed heap before it is
allocated in the beginning of the application execution?
The thing is that our app is deployed on a machine on which other apps run.
There other apps require most of the computer's resources, and thus our .NET
app must not consume to much memory.
Thanks.
Willy Denoyette [MVP] - 27 Sep 2005 22:20 GMT
The amount of memory used by your application is determined by ... your
application, not by the initial size of the GC heap, the initial heap is 32
MB VIRTUAL (not committed) memory. The number of objects and their sizes
will determine the size of the effective committed heap space, the more
objects you keep alive the more memory you'll need.

Willy.

> Hi to all.
> Is there a way to control the size of the managed heap before it is
[quoted text clipped - 5 lines]
> app must not consume to much memory.
> Thanks.
Amir Shitrit - 28 Sep 2005 18:35 GMT
What does it mean non committed memory?
Why does a simple hello world application requires 6,284MB of memory?

> The amount of memory used by your application is determined by ... your
> application, not by the initial size of the GC heap, the initial heap is 32
[quoted text clipped - 13 lines]
> > app must not consume to much memory.
> > Thanks.
Willy Denoyette [MVP] - 28 Sep 2005 23:24 GMT
"Non Committed" memory is Memory that is reserved by the process but not yet
committed by the OS.
Please consult MSDN for details on how the memory management functions in
Windows.

A simple "Hello world" program needs to load some windows system DLL's the C
runtime and the .NET runtime before it can run, that means a bunch of DLL
are getting loaded (just like any other process) plus the .NET runtime (CLR
runtime DLL's) and the initial managed heap.
Willy.

> What does it mean non committed memory?
> Why does a simple hello world application requires 6,284MB of memory?
[quoted text clipped - 17 lines]
>> > app must not consume to much memory.
>> > Thanks.
Amir Shitrit - 29 Sep 2005 16:57 GMT
So what your'e saying, is that my application reserves to itself more memory
than it currently requires, but might use in the future - which brings me to
my original question: is there a way to minimize the amount of reserved
memory of my application?

> "Non Committed" memory is Memory that is reserved by the process but not yet
> committed by the OS.
[quoted text clipped - 28 lines]
> >> > app must not consume to much memory.
> >> > Thanks.
Willy Denoyette [MVP] - 29 Sep 2005 19:42 GMT
> So what your'e saying, is that my application reserves to itself more
> memory
> than it currently requires, but might use in the future - which brings me
> to
> my original question: is there a way to minimize the amount of reserved
> memory of my application?

The default segment sizes for the GC heap are set to 16 MB for the
workstation GC and 64 MB for the server version GC. The GC starts with two
segments one for the normal heap and one for the large object heap.
What you can do is reserve smaller segments (min. 4MB per segment) by
creating you own CLR hosting process using the framework v2.0 unmanaged
hosting API's (search the MSDN docs. for details) , but this makes little
sense as reserved memory does not take up RAM space, and as soon as the
framework starts to create objects , the reserved space will be comitted and
will grow beyond what was reserved and new segments will be created.
Note that even so, you will never be able to run a minimal .NET program into
something that takes less than ~6MB (the working set). What exactly are you
trying to achieve?

Willy.
Amir Shitrit - 29 Sep 2005 22:05 GMT
My team leader asked me to find a way to minimize our app memory consumption.
He claims to use some method to compact the the app's memory consumption,
and wan't to find a way to avoid it by minimizing the initial memory
consumtion.
Does it make any sence?

> > So what your'e saying, is that my application reserves to itself more
> > memory
[quoted text clipped - 17 lines]
>
> Willy.

Rate this thread:







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.