473,722 Members | 2,295 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I decrease size of mem usage.

Hi,

I've written a somewhat large program over the years (70.000 lines of code).
When compiling the program I get a 2MB exe file. When running this program I
get an corresponding image in the task manager showing a 40 MB memory
allocation . Yes, the program allocates memory dynamicaly, but no where near
this amout of memory. Of cause I expect some .net stuff is probably also
contained in this allocation. However, if reinstantiating the program several
times, every instance (shown in the task manager) is showing a memory usage
of around 40-50 MB. I thought that code was shared in such scenarios in order
to save memory space.

Q: What si happening in .net?

Q: Is there any flag/compiler option that I can check/uncheck to a smaller
memory allocation.

Best regards
Jesper, Denmark
Nov 10 '06 #1
3 2685
Hello, this is not easy to respond, if you have a lot of memory the
application will use as much memory as his can (for the optimization, and
fast loading). Example: I have an app that have almost 500.000 Lines of
code, If I run the code in a machine that have 2 GB of memory the
application uses More that 150 MB, but if I run the same App in a machine
with 256 or 128 MB of ram the app run with a 35 MB of ram. In each case the
application run well, in both machines.

PD: The Compiler, don't allow you to do an intensive memory optimization,
that is because the runtime handles the memory for the applications not the
compiler.

Regards,

Bela Istok

"Jesper, Denmark" <Je***********@ discussions.mic rosoft.comwrote in message
news:A6******** *************** ***********@mic rosoft.com...
Hi,

I've written a somewhat large program over the years (70.000 lines of
code).
When compiling the program I get a 2MB exe file. When running this program
I
get an corresponding image in the task manager showing a 40 MB memory
allocation . Yes, the program allocates memory dynamicaly, but no where
near
this amout of memory. Of cause I expect some .net stuff is probably also
contained in this allocation. However, if reinstantiating the program
several
times, every instance (shown in the task manager) is showing a memory
usage
of around 40-50 MB. I thought that code was shared in such scenarios in
order
to save memory space.

Q: What si happening in .net?

Q: Is there any flag/compiler option that I can check/uncheck to a smaller
memory allocation.

Best regards
Jesper, Denmark


Nov 10 '06 #2
"Jesper, Denmark" <Je***********@ discussions.mic rosoft.comwrote in message
news:A6******** *************** ***********@mic rosoft.com...
Hi,

I've written a somewhat large program over the years (70.000 lines of code).
When compiling the program I get a 2MB exe file. When running this program I
get an corresponding image in the task manager showing a 40 MB memory
allocation . Yes, the program allocates memory dynamicaly, but no where near
this amout of memory. Of cause I expect some .net stuff is probably also
contained in this allocation. However, if reinstantiating the program several
times, every instance (shown in the task manager) is showing a memory usage
of around 40-50 MB. I thought that code was shared in such scenarios in order
to save memory space.

Q: What si happening in .net?

Q: Is there any flag/compiler option that I can check/uncheck to a smaller
memory allocation.

Best regards
Jesper, Denmark


First of, there a a lot of significant memory counters available, what kind of memory
consumption are you talking about?
Second, the size of the exe file has strictly nothing to do with the memory consumption when
the program runs.
A 1KB exe can consume Giga bytes of memory when it runs, all depends on what the program is
doing, what kind and how many objects are there allocated at any time.
Note also that your exe is only (a small) part of the assemblies and DLL's loaded when the
program runs. If this is a windows forms application some more memory is taken by the forms
library and the higher number of objects allocated during forms initialization. Also take
into account that every managed program has at least 3 or 4 threads, that means 3 (4) x 1MB
for stack allocation (committed). And the GC heap starts with a allocated (Reserved) size of
32 MB. So, 40MB is really nothing to worry about.

Willy.


Nov 10 '06 #3
Hi,

Are you keeping references to instances you dont longer needs?

IIRC the minimal memory ocupation of an application is from 15 -+4

So yours is not that far off.

In any case , use a memory profiler to see how the memory is being allocated
"Jesper, Denmark" wrote:
Hi,

I've written a somewhat large program over the years (70.000 lines of code).
When compiling the program I get a 2MB exe file. When running this program I
get an corresponding image in the task manager showing a 40 MB memory
allocation . Yes, the program allocates memory dynamicaly, but no where near
this amout of memory. Of cause I expect some .net stuff is probably also
contained in this allocation. However, if reinstantiating the program several
times, every instance (shown in the task manager) is showing a memory usage
of around 40-50 MB. I thought that code was shared in such scenarios in order
to save memory space.

Q: What si happening in .net?

Q: Is there any flag/compiler option that I can check/uncheck to a smaller
memory allocation.

Best regards
Jesper, Denmark

Nov 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1983
by: S.J. te Winkel | last post by:
Hi all, I have the following challenge: I want a table with 3 columns, in which -the left one has a maximum width of 470px -the middle one always has a fixed width of 180 px, -and the right one fills the remaining part of the screen. When you resize the window (smaller, or with a smaller resolution) I
2
5254
by: Sue | last post by:
I have a large database currently using up 30GB of space -- problem is, I am running out of space on my harddrive and so have to do some cleanup. One of the tables has a blob field and I find that I can safely delete some of this blob data because I will not be needing it in the database anymore. So the question is, if I delete some of the blob data from this table will the database size decrease? Is there anything else I can do to...
3
5130
by: | last post by:
I wrote an application and I want to decrease "system's" audio level .I dont want to do it via directshow must do it on directly window's wave volume control. Thankse
2
1623
by: Fish | last post by:
I have been researching the correct way to organize my solution so that it makes best use of VB.NET inherent ability to manage resources such as objects. My solution contains 2 projects and the main problem is that the mem usage continues to grow until the Service stops responding. I have received advice to: "create those objects at a class level; instantiate them when the service starts, and dispose of them when the service ends. Then...
12
5906
by: baibaichen | last post by:
i know that pImpl idiom can decrease compile time, but Is there any good practice/idiom to decrease link time? any reference or any idea is appreciated thanks
8
1880
by: NAdir | last post by:
Hi, thank you for your help. My VB.Net application contains a document that the user can refresh at any time. The refresh works fine and needs to loop through few datatables (hundreds of rows). This works fine until I delete some rows in two tables. Just after the delete if I do the refresh there is a huge memory allocated and the time needed to perform the refresh increase, the memory and time continue to increase on each refresh until I...
45
2900
by: charles.lobo | last post by:
Hi, I have recently begun using templates in C++ and have found it to be quite useful. However, hearing stories of code bloat and assorted problems I decided to write a couple of small programs to check. What I expected was that there would be minor code bloat and some speed improvement when using templates. However... I wrote a basic list container (using templates), and a list container (using virtual derived classes). I also tried...
6
5718
by: =?Utf-8?B?bGlnaHRkb2xs?= | last post by:
Hello everyone. i want to know how to decrease the cpu usage in my program. i have to update quickly many data on gui, so i tried to decrease the cpu usage on gui but i couldn't solve the problem. i found the code with probloem why the cpu usage increased by debug..
3
1868
by: veer | last post by:
hi i have a database in sql server of size 30gb how i decrease the database size but data should not be loos please send some idea varinder
0
8863
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8739
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9238
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9088
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8052
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6681
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2147
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.