473,461 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

C# is good for memory usage?

Hi,

Anyone suffers from the high memory usage of C# in windows applications? Is
there a solution for that problem? Thanks...
Oct 18 '06 #1
9 5183
Adam,

What kind of memory usage are you observing? When I start an empty
windows application it consumes more than 8MB (as shown on the vm usage
column in task manager). That's perfectly normal.

Brian

Adam Right wrote:
Hi,

Anyone suffers from the high memory usage of C# in windows applications? Is
there a solution for that problem? Thanks...
Oct 18 '06 #2
Hello Adam,

How do u profile you app to get the memory usage?

ARHi,
AR>
ARAnyone suffers from the high memory usage of C# in windows
ARapplications? Is there a solution for that problem? Thanks...
AR>
---
WBR,
Michael Nemtsev :: blog: http://spaces.live.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Oct 18 '06 #3
How high is high?

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Shooter
http://unclechutney.blogspot.com

A man, a plan, a canal, a palindrome that has.. oh, never mind.

"Adam Right" <ad**@right.comwrote in message
news:O5*************@TK2MSFTNGP05.phx.gbl...
Hi,

Anyone suffers from the high memory usage of C# in windows applications?
Is there a solution for that problem? Thanks...

Oct 18 '06 #4
"Brian Gideon" wrote:
When I start an empty
windows application it consumes more than 8MB (as shown on the vm usage
column in task manager). That's perfectly normal.
Empty app uses 8 MB? it's a hog.

I've just tried a very small C# console app on XP-64. It takes 13 MB!
On that machine:
Windows Explorer uses 32 MB
wmiprvse - 7.5 MB
Most of system tasks are under 8 MB.

Isn't this a bit worrying?

--PA

Oct 18 '06 #5

Pavel A. wrote:
Isn't this a bit worrying?
Pavel,

Maybe, but since it's not uncommon to have 2000MB on a system it
represents a very small percentage. Plus, since the OS has already
allocated that memory to the GC object creation should be faster than
it would be otherwise.

Brian

Oct 19 '06 #6
PS

"Pavel A." <pa*****@NOwritemeNO.comwrote in message
news:47**********************************@microsof t.com...
"Brian Gideon" wrote:
>When I start an empty
windows application it consumes more than 8MB (as shown on the vm usage
column in task manager). That's perfectly normal.

Empty app uses 8 MB? it's a hog.

I've just tried a very small C# console app on XP-64. It takes 13 MB!
On that machine:
Windows Explorer uses 32 MB
wmiprvse - 7.5 MB
Most of system tasks are under 8 MB.

Isn't this a bit worrying?
At todays memory prices that is costing you about $2. I would be worrying!

Oct 19 '06 #7

"Pavel A." <pa*****@NOwritemeNO.comwrote in message
news:47**********************************@microsof t.com...
| "Brian Gideon" wrote:
| When I start an empty
| windows application it consumes more than 8MB (as shown on the vm usage
| column in task manager). That's perfectly normal.
|
| Empty app uses 8 MB? it's a hog.
|
| I've just tried a very small C# console app on XP-64. It takes 13 MB!
| On that machine:
| Windows Explorer uses 32 MB
| wmiprvse - 7.5 MB
| Most of system tasks are under 8 MB.
|
| Isn't this a bit worrying?
|

Not at all, who tells you that Explorer written in C# would use that much
more? (say 48MB)
The same for wmiprvse, which is a do nothing service as long as you are
using WMI from a client application, I've seen this service consuming >
300MB.
The point is that managed applications have a larger "base memory footprint"
when compared to native applications, this is the result of the CLR loading
a set of initial assemblies and the GC heap. A "complex" console application
won't take that much more than 8 -10MB, what really take memory are the data
structures (the objects allocated from the heap), and this is where the
problem is.
The framework makes it easy to over-consume, it doesn't force you to think
about memory consumption when selecting your containers, this is
fundamentally different from low level code like C where you are forced to
think about "efficient data structure usage" because you have to define them
yourself. Using C++ and STL containers tend toward over-consumption as well,
but as most C++ programmers have a C background, they have the natural
reflection to think about efficiency when selecting containers and
algorithms.
Note that I don't mean to say that you can author an application in managed
code that is as efficient when it comes to memory consumption as it would
have been written in C, you can't, you will always consume at least a few MB
more.
There is the managed environment (GC heap, large framework libraries)
overhead and the "everything is an object" overhead you need to accept, if
you can't, you have selected the wrong development platform and you need to
go back to unmanaged, but be prepared to spend a hell of a time to think
about efficient memory allocation/de-allocation, not to mention the
algorithms and the implementation of the functionality available in the
framework.

Willy.


Oct 19 '06 #8
PRP

Isn't this a bit worrying?
Looks like, not a worrying fact for newer version of frameworks.

Empty application built using framework 1.1 took 14 MB in my system.
and it is 15 MB for 2.0

Oct 19 '06 #9
It all depends on your goal. Once you have one .Net application
running there are shared system resources loaded that all other .net
apps will use. As previously stated tehre is a base memory footprint
that will be larger than native applications, but a negligible one. If
only a few megs of ram is a problem on your system you should look into
offloading some of the apps and/or beefing up the system.

..Net is not meant to be the most resource effecient framework. It is
meant for rapid business application development. You give up a little
resource management and control for a huge increase in the development
time effeciencies. If you need a very effecient program, .Net is not
the way to go...go with a native language like C. By the way, C# and
VB both use the CLR so memory usage will be the same for either one.
Adam Right wrote:
Hi,

Anyone suffers from the high memory usage of C# in windows applications? Is
there a solution for that problem? Thanks...
Oct 19 '06 #10

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

Similar topics

8
by: rbt | last post by:
Would a Python process consume more memory on a PC with lots of memory? For example, say I have the same Python script running on two WinXP computers that both have Python 2.4.0. One computer has...
5
by: Justice | last post by:
Currently I'm doing some experimenting with the XMLHTTP object in Javascript. Now, the XMLHttp object is asynchronous (at least in this case), and the following code causes a significant memory...
2
by: tomvr | last post by:
Hello I have noticed some 'weird' memory usage in a vb.net windows app The situation is as follows I have an app (heavy on images) with 2 forms (actually there are more forms and on starting...
6
by: Tom | last post by:
We have a VERY simple .NET C# Form Application, that has about a 23MB Memory Footprint. It starts a window runs a process and does a regular expression. I have done a GC.Collect to make sure that,...
2
by: Jarvis | last post by:
I've made a testing program to test the memory usage of some Data Forms. I create a MDI parent form with one single MDI child form, which is a Data Form generated by .NET Data Form Wizard. To...
20
by: Philip Carnstam | last post by:
How come .Net applications use so much memory? Every application I compile uses at least 10 MB of memory, even the ones consisting of only a form and nothing else. If I minimize them though the...
48
by: Tony | last post by:
How much bloat does the STL produce? Is it a good design wrt code bloat? Do implementations vary much? Tony
6
by: dspfun | last post by:
I would like to analyze my running c-program. What I would like to know for example is the range of the entire address space of my running c-program (memory reserved for/by the running program),...
1
by: Jean-Paul Calderone | last post by:
On Tue, 22 Apr 2008 14:54:37 -0700 (PDT), yzghan@gmail.com wrote: The test doesn't demonstrate any leaks. It does demonstrate that memory usage can remain at or near peak memory usage even after...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...
1
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...
0
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...
0
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,...
0
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...
0
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...

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.