Groups | Blog | Home
all groups > dotnet clr > july 2004 >

dotnet clr : How to specify the initial memory size for a application?



Lei Jiang
7/21/2004 9:58:30 AM
I have a program that cost a lot of memory. During the load of the program,
more and more memory is being allocated. I'd like to know if I specify a
large initial memory size for the application, would its load speed be
increased? If so, how can I specify that?

Thanks!


Pandurang Nayak
7/21/2004 3:14:01 PM
I do not know the specifics of your application, but surely doesn't look like a good sign that your application keeps consuming more and more memory.

Pandurang Nayak
7/22/2004 3:03:03 AM
In that case - yes.. if you did specify data structures that are going to hold the data read from the database, and you explicitly allocate memory (say by declaring size of an array, etc.) - then you could save a little on loading time.

Lei Jiang
7/22/2004 12:48:39 PM
I mean the program load more and more data from database at its startup
time. After the data is load, the memory usage is stable.

"Pandurang Nayak" <npandurang_AT_blr_DOT_cognizant_DOTcom_NOSPAM> дÈëÏûÏ¢
news:626AC943-6271-4DAD-8F1F-D8CA07649B98@microsoft.com...
[quoted text, click to view]
your application's memory requirements. Then you should be able to make
better design decisions.

Lei Jiang
7/22/2004 9:56:06 PM
These are two different things. Allocating memory by declaring size of an
array is something inside application, specifing initial size for the
application is outside the program. If the initial memory size is large
enough, allocating memory by declaring an array will cause less Win32 memory
allocation and less page swap, and my program will run faster.

"Pandurang Nayak" <npandurang_AT_blr_DOT_cognizant_DOTcom_NOSPAM> дÈëÏûÏ¢
news:5B82AF15-8A04-408C-BD5B-E7227E44B0B6@microsoft.com...
[quoted text, click to view]
hold the data read from the database, and you explicitly allocate memory
(say by declaring size of an array, etc.) - then you could save a little on
loading time.
[quoted text, click to view]
is a good practice or not.

Willy Denoyette [MVP]
7/25/2004 8:05:33 PM
How that? If you could, (but fortunately you can't) set the initial size to
something larger than the free (RAM) memory, the system would start swapping
at program start.
If the system starts swapping when your application runs, it's an indication
that you are consuming more memory than you have free in RAM. So it will
always swap.

There are only two things you can do in such situation:
- Review your design in order to reduce the working set of your application.
- Add more RAM.

Willy.


[quoted text, click to view]

Christopher Wells
7/26/2004 5:03:30 PM

[quoted text, click to view]

There's a Win32 API called SetWorkingSet that affects how much swapping will
happen; a program must be priviledged to call this API (it can reduce the
RAM available to other applications).

Lei Jiang
7/27/2004 1:07:06 PM
It seems Process.MinWorkSet and Process.MaxWorkSet do the same thing? I will
try it.

Thanks!

"Christopher Wells" <christopher_wells@invalid.invalid> дÈëÏûÏ¢
news:OuU90M1cEHA.1656@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button