473,785 Members | 3,245 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Much larger memory use, normal?


Should I be concerned with the amount of memory my C# applications use?

I have 2 gigs of ram, and I use most of that without running any C#
applications. So, when I see C# applications in development, which are
using much more memory than their Delphi and Python equivalents, I am a
bit worried.

Is there more than meets the eye or is it simply deemed acceptable for
the platform?

-AB
Nov 15 '05 #1
8 4924
C# applications do have a larger footprint because the .NET framework has to
load into memory as well.

"Afanasiy" <ab********@hot mail.com> wrote in message
news:80******** *************** *********@4ax.c om...

Should I be concerned with the amount of memory my C# applications use?

I have 2 gigs of ram, and I use most of that without running any C#
applications. So, when I see C# applications in development, which are
using much more memory than their Delphi and Python equivalents, I am a
bit worried.

Is there more than meets the eye or is it simply deemed acceptable for
the platform?

-AB

Nov 15 '05 #2
Afanasiy <ab********@hot mail.com> wrote in
news:80******** *************** *********@4ax.c om:

Should I be concerned with the amount of memory my C#
applications use?

I have 2 gigs of ram, and I use most of that without running any
C# applications. So, when I see C# applications in development,
which are using much more memory than their Delphi and Python
equivalents, I am a bit worried.

Is there more than meets the eye or is it simply deemed
acceptable for the platform?


Afanasiy,

Are you using Task Manager (TM) to calculate memory usage? If so, I
think you can ignore those numbers. AFAIK, Microsoft has never made
the algorithm TM uses to calculate memory usage public, so there is
no way to really know what TM is reporting.

Try this to see what I mean:

- open TM.
- start your .Net application.
- note your .Net app's memory usage as reported by TM.
- minimize your .Net app.
- again note your .Net app's memory usage as reported by TM.
- restore your .Net app.
- again note your .Net app's memory usage as reported by TM.

The three memory readings will vary wildly depending upon the state
of your application's main form.

Instead of using TM, use PerfMon:

http://msdn.microsoft.com/library/de...l=/library/en-
us/cpgenref/html/cpconruntimepro filing.asp

(or http://tinyurl.com/ypt4t)

or get a .Net-specific memory profiler:

http://www.scitech.se/memprofiler/.

Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 15 '05 #3
On Sun, 25 Jan 2004 18:23:36 -0800, "Peter Rilling"
<pe***@nospam.r illing.net> wrote:
C# applications do have a larger footprint because the .NET framework has to
load into memory as well.


I suppose you mean every I use adds to the memory footprint. This
happens in Delphi and Python as well. Use a module and you incorporate
overhead.

If this is the reason C# applications use much more memory, then I
am surprised the resources for these modules is in no way shared.

I don't think this is exactly it though.

Nov 15 '05 #4
On Sun, 25 Jan 2004 21:49:58 -0800, "Chris R. Timmons"
<crtimmons@X_NO SPAM_Xcrtimmons inc.com> wrote:
Afanasiy <ab********@hot mail.com> wrote in
news:80******* *************** **********@4ax. com:

Should I be concerned with the amount of memory my C#
applications use?

I have 2 gigs of ram, and I use most of that without running any
C# applications. So, when I see C# applications in development,
which are using much more memory than their Delphi and Python
equivalents, I am a bit worried.

Is there more than meets the eye or is it simply deemed
acceptable for the platform?
Afanasiy,

Are you using Task Manager (TM) to calculate memory usage? If so, I
think you can ignore those numbers. AFAIK, Microsoft has never made
the algorithm TM uses to calculate memory usage public, so there is
no way to really know what TM is reporting.


Actually, GetProcessMemor yInfo can report the same numbers task manager
does. I never ran an API monitor to verify this. However, the fact that
the numbers for WorkingSetSize and PeakWorkingSetS ize as returned by the
Win32 API GetProcessMemor yInfo have always been the same as those seen in
the task manager is enough for me.
Try this to see what I mean:

- open TM.
- start your .Net application.
- note your .Net app's memory usage as reported by TM.
- minimize your .Net app.
- again note your .Net app's memory usage as reported by TM.
- restore your .Net app.
- again note your .Net app's memory usage as reported by TM.

The three memory readings will vary wildly depending upon the state
of your application's main form.


The memory use changes you see when minimizing applications is just
windows calling SetProcessWorki ngSetSize. This is expected behaviour.

I have attempted some clever implementations of SetProcessWorki ngSetSize
in my C# applications and they can bring down memory use, but that is
deceptive and destructive to performance. It is primarily a hack.

-AB
Nov 15 '05 #5
Well, anyone of you realizes that

GetProcessWorki ngSetSize

does NOT report memory used? It reports the size of the working set, which
does mot mean that this set actually is allocated memory (virtual or
physical). THe numbers reported back are larger for .NET applcations because
the .NET runtime is a little aggressive setting it's working set size, given
that - she does not allocate any ressources (a.k.a. RAM in this context).

The TaskManager numbers are meaningless for managed applications.

--
Regards

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
(CTO PowerNodes Ltd.)
---

Still waiting for ObjectSpaces? Tr the EntityBroker today - more versatile,
more powerfull.
And something in use NOW. for the projects you have to deliver - NOW.
"Afanasiy" <ab********@hot mail.com> wrote in message
news:pp******** *************** *********@4ax.c om...
On Sun, 25 Jan 2004 21:49:58 -0800, "Chris R. Timmons"
<crtimmons@X_NO SPAM_Xcrtimmons inc.com> wrote:
Afanasiy <ab********@hot mail.com> wrote in
news:80******* *************** **********@4ax. com:

Should I be concerned with the amount of memory my C#
applications use?

I have 2 gigs of ram, and I use most of that without running any
C# applications. So, when I see C# applications in development,
which are using much more memory than their Delphi and Python
equivalents, I am a bit worried.

Is there more than meets the eye or is it simply deemed
acceptable for the platform?


Afanasiy,

Are you using Task Manager (TM) to calculate memory usage? If so, I
think you can ignore those numbers. AFAIK, Microsoft has never made
the algorithm TM uses to calculate memory usage public, so there is
no way to really know what TM is reporting.


Actually, GetProcessMemor yInfo can report the same numbers task manager
does. I never ran an API monitor to verify this. However, the fact that
the numbers for WorkingSetSize and PeakWorkingSetS ize as returned by the
Win32 API GetProcessMemor yInfo have always been the same as those seen in
the task manager is enough for me.
Try this to see what I mean:

- open TM.
- start your .Net application.
- note your .Net app's memory usage as reported by TM.
- minimize your .Net app.
- again note your .Net app's memory usage as reported by TM.
- restore your .Net app.
- again note your .Net app's memory usage as reported by TM.

The three memory readings will vary wildly depending upon the state
of your application's main form.


The memory use changes you see when minimizing applications is just
windows calling SetProcessWorki ngSetSize. This is expected behaviour.

I have attempted some clever implementations of SetProcessWorki ngSetSize
in my C# applications and they can bring down memory use, but that is
deceptive and destructive to performance. It is primarily a hack.

-AB

Nov 15 '05 #6
On Mon, 26 Jan 2004 09:07:31 +0100, "Thomas Tomiczek [MVP]"
<t.********@tho na-consulting.com> wrote:
Well, anyone of you realizes that

GetProcessWork ingSetSize

does NOT report memory used? It reports the size of the working set, which
does mot mean that this set actually is allocated memory (virtual or
physical). THe numbers reported back are larger for .NET applcations because
the .NET runtime is a little aggressive setting it's working set size, given
that - she does not allocate any ressources (a.k.a. RAM in this context).


If the memory use I am seeing was that benign, then I would have no way
to explain the much larger number of page faults in my C# applications.

As such, I don't think that's just it. I think it is in fact using much
of the memory in the working set. It increases it often and page faults
often. That does not indicate simply having a large working set size for
aggressive performance.

Nov 15 '05 #7
A Page fault also happens when non-used memory gets allocated.

The working set in itself means nothing :-)

--
Regards

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
(CTO PowerNodes Ltd.)
---

Still waiting for ObjectSpaces? Tr the EntityBroker today - more versatile,
more powerfull.
And something in use NOW. for the projects you have to deliver - NOW.
"Afanasiy" <ab********@hot mail.com> wrote in message
news:9q******** *************** *********@4ax.c om...
On Mon, 26 Jan 2004 09:07:31 +0100, "Thomas Tomiczek [MVP]"
<t.********@tho na-consulting.com> wrote:
Well, anyone of you realizes that

GetProcessWork ingSetSize

does NOT report memory used? It reports the size of the working set, whichdoes mot mean that this set actually is allocated memory (virtual or
physical). THe numbers reported back are larger for .NET applcations becausethe .NET runtime is a little aggressive setting it's working set size, giventhat - she does not allocate any ressources (a.k.a. RAM in this context).


If the memory use I am seeing was that benign, then I would have no way
to explain the much larger number of page faults in my C# applications.

As such, I don't think that's just it. I think it is in fact using much
of the memory in the working set. It increases it often and page faults
often. That does not indicate simply having a large working set size for
aggressive performance.

Nov 15 '05 #8
On Mon, 26 Jan 2004 20:38:30 +0100, "Thomas Tomiczek [MVP]"
<t.********@tho na-consulting.com> wrote:
A Page fault also happens when non-used memory gets allocated.

The working set in itself means nothing :-)


So basically, you are saying it's not using 3-10 times as much memory,
and that the 3-10 times as many page faults have nothing to do with
going to secondary storage for program instructions and data, indicative
of requiring a larger working set size. (which I watch it increase)

That I don't believe, and I must imagine approaching and surpassing my
virtual and physical memory limitations with a C# application would be
something to worry about.

As such, I can so far only imagine that C# is in fact using the working
set size, which it deems necessary to increase when it uses more, and
that the page faults are not completely benign.

Given the replies, I must say it is simply something people have accepted.

Since manually setting the working set size causes even more dramatic
performance degradation, I cannot consider that a possible solution.

So, is there one? A solution which would prove that C# applications are
in fact not using the memory in their working set, which they would
increase for no good reason, and which page fault for no bad reason?

-AB
Nov 15 '05 #9

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

Similar topics

8
1884
by: TheB | last post by:
Ok, lets try this again. I have a program which searches all disk drives for certain file types. When it finds a file it writes a record to a Firebird DB. The program normally is using 40 - 44 megs. However after running for about a minute the memory usage suddenly jumps up to 440 - 450 megs for about 15 - 20 seconds and then instantly drops back to normal usage. When the memory load peaks the program stop scanning and resumes when...
0
3907
by: Frank Lopez | last post by:
Does anyone know if Microsoft generated a whitepaper on this topic? Does anyone know what the solution is? (meaning, eliminate the leak problem -- I am seeing three memory leaks from dllmodul.cpp(102) similar to what is mentioned below)... I am calling MFC as part of unmanaged code used by the managed code. +--------
5
1767
by: Martin Wolff | last post by:
Hi !! To draw multiple graphics objects which have different shapes, I’m using the region class to exclude/union the drawing area of these Objects. The rectangle around a single object is of the size of 80x80 pixels. So looping through these pixels and excluding the area of every transparent pixel, the region will be built. Afterwards, such an object has a memory usage of approx. 700Kb (before
15
2419
by: Joe Fallon | last post by:
I would like to know how you can figure out how much memory a given instance of a class is using. For example, if I load a collection class with 10 items it might use 1KB, and if I load it with 1000 items it might use 100KB. How do I measure the amount of memory used once the class is loaded? Thanks! -- Joe Fallon
9
1509
by: Shrage H. Smilowitz | last post by:
I have created an empty windows forms project, added one form and loaded it, i checked in task manager and the application takes 18,748 MB of ram, why does it take som much to load just one form? Also i have build a larger application and with every step it uses more and more memory it doesnt get smaller, everty data object i create gets disposed, why is it? Where can i find more info about how memorty is handeld.
1
1229
by: João Santa Bárbara | last post by:
i don´t know what microsoft guys are doing but, i ´m developing a windows forms application with 12 open projects associated and my Visual Studio 2005 at start consume more than half of my available resources, about ( 600 MBs Memory ) divided by phisical and Virtual is this normal ??? And evey time i open the form in the designer it allocs more memory. but it does not free any memory it allways allocs more. the microsoft dudes don´t...
12
12155
by: elty123 | last post by:
I have a small C# program (about 400 lines of code) that is only 28kb after compiled. However when it runs (takes a whole 5 seconds) it takes up nearly 20MB of memory and I don't see why. Some of the assembly I used: using System; using System.Collections.Generic;
0
1634
by: George2 | last post by:
Hello everyone, Sorry that this question is related to another question I posted some time before because I have some new findings and self-analysis. My question is why sometimes from perfmon on Windows, working set larger than virtual memory? I think virtual memory is the total size of memory (committed, reserved, shared, private) and working set is just the RAM touched by current process currently. Virtual memory should always larger...
7
3660
by: Sanny | last post by:
I have an app in Java. It works fine. Some people say Java works as fast as C. Is that true? C can use assembly language programs. How much faster are they inplace of calling general routines. Can C++ directly acess the Registers. Will the Computation 5-10 times faster than Java?
0
9645
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
10148
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...
1
10091
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9950
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
8972
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...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3646
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2879
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.