473,382 Members | 1,332 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 4903
C# applications do have a larger footprint because the .NET framework has to
load into memory as well.

"Afanasiy" <ab********@hotmail.com> wrote in message
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?

-AB

Nov 15 '05 #2
Afanasiy <ab********@hotmail.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.

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/cpconruntimeprofiling.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.rilling.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_NOSPAM_Xcrtimmonsinc.com> wrote:
Afanasiy <ab********@hotmail.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, GetProcessMemoryInfo 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 PeakWorkingSetSize as returned by the
Win32 API GetProcessMemoryInfo 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 SetProcessWorkingSetSize. This is expected behaviour.

I have attempted some clever implementations of SetProcessWorkingSetSize
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

GetProcessWorkingSetSize

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********@hotmail.com> wrote in message
news:pp********************************@4ax.com...
On Sun, 25 Jan 2004 21:49:58 -0800, "Chris R. Timmons"
<crtimmons@X_NOSPAM_Xcrtimmonsinc.com> wrote:
Afanasiy <ab********@hotmail.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, GetProcessMemoryInfo 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 PeakWorkingSetSize as returned by the
Win32 API GetProcessMemoryInfo 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 SetProcessWorkingSetSize. This is expected behaviour.

I have attempted some clever implementations of SetProcessWorkingSetSize
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.********@thona-consulting.com> wrote:
Well, anyone of you realizes that

GetProcessWorkingSetSize

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********@hotmail.com> wrote in message
news:9q********************************@4ax.com...
On Mon, 26 Jan 2004 09:07:31 +0100, "Thomas Tomiczek [MVP]"
<t.********@thona-consulting.com> wrote:
Well, anyone of you realizes that

GetProcessWorkingSetSize

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.********@thona-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
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...
0
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...
5
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...
15
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...
9
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? ...
1
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...
12
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. ...
0
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...
7
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. ...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.