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 / July 2004

Tip: Looking for answers? Try searching our database.

How to specify the initial memory size for a application?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lei Jiang - 21 Jul 2004 02:58 GMT
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 - 21 Jul 2004 23:14 GMT
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.

Take a look at the CLR Profiler tool from Microsoft and try to profile your application's memory requirements. Then you should be able to make better design decisions.
Lei Jiang - 22 Jul 2004 05:48 GMT
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.

> 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.
>
> Take a look at the CLR Profiler tool from Microsoft and try to profile your application's memory requirements. Then you should be able to make
better design decisions.
Pandurang Nayak - 22 Jul 2004 11:03 GMT
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.

However, again it is application-specific to see if such a "hard-coding" is a good practice or not.
Lei Jiang - 22 Jul 2004 14:56 GMT
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.

> 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.

> However, again it is application-specific to see if such a "hard-coding" is a good practice or not.
Willy Denoyette [MVP] - 25 Jul 2004 19:05 GMT
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.

> These are two different things. Allocating memory by declaring size of an
> array is something inside application, specifing initial size for the
[quoted text clipped - 11 lines]
>> However, again it is application-specific to see if such a "hard-coding"
> is a good practice or not.
Christopher Wells - 26 Jul 2004 22:03 GMT
> 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.

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 - 27 Jul 2004 06:07 GMT
It seems Process.MinWorkSet and Process.MaxWorkSet do the same thing? I will
try it.

Thanks!

> > These are two different things. Allocating memory by declaring size of an
> > array is something inside application, specifing initial size for the
[quoted text clipped - 6 lines]
> happen; a program must be priviledged to call this API (it can reduce the
> RAM available to other applications).

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.