473,400 Members | 2,163 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,400 software developers and data experts.

Memory Usage

Hello Everyone..

Why when i build a REAAALY simples Console app with C#, when i compile
using the realese method and execute, it already occupies almost 7mb of
memory???

as simple as that!!
for(int i = 0; i<= 1000; i++)
for(int j = 0; j<= 1000; j++)
Console.WriteLine(i + "." + j);

How to make realy light programs...like some Google programs that use
600kb...

Thanks!

Sep 11 '06 #1
7 1533
You are not actually _using_ 7mb of memory there ... memory is allocated in
chunks ... you then instantiate objects using bits of these chunks.. When
the application starts up it gets memory for you to use.

You also have the overhead in the runtime to contend with. Quite simply C#
is the wrong tool to write a program with 600k of overhead.

Cheers,

Greg

"IsRaEl" <yz****@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
Hello Everyone..

Why when i build a REAAALY simples Console app with C#, when i compile
using the realese method and execute, it already occupies almost 7mb of
memory???

as simple as that!!
for(int i = 0; i<= 1000; i++)
for(int j = 0; j<= 1000; j++)
Console.WriteLine(i + "." + j);

How to make realy light programs...like some Google programs that use
600kb...

Thanks!

Sep 11 '06 #2
IsRaEl,

Because you are paying for garbage collection, memory management, etc,
etc.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"IsRaEl" <yz****@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
Hello Everyone..

Why when i build a REAAALY simples Console app with C#, when i compile
using the realese method and execute, it already occupies almost 7mb of
memory???

as simple as that!!
for(int i = 0; i<= 1000; i++)
for(int j = 0; j<= 1000; j++)
Console.WriteLine(i + "." + j);

How to make realy light programs...like some Google programs that use
600kb...

Thanks!

Sep 11 '06 #3
Sooo..

To write really light apps i should do it directly with C++ or maybe
Python??

Greg Young wrote:
You are not actually _using_ 7mb of memory there ... memory is allocated in
chunks ... you then instantiate objects using bits of these chunks.. When
the application starts up it gets memory for you to use.

You also have the overhead in the runtime to contend with. Quite simply C#
is the wrong tool to write a program with 600k of overhead.

Cheers,

Greg

"IsRaEl" <yz****@gmail.comwrote in message
news:11**********************@d34g2000cwd.googlegr oups.com...
Hello Everyone..

Why when i build a REAAALY simples Console app with C#, when i compile
using the realese method and execute, it already occupies almost 7mb of
memory???

as simple as that!!
for(int i = 0; i<= 1000; i++)
for(int j = 0; j<= 1000; j++)
Console.WriteLine(i + "." + j);

How to make realy light programs...like some Google programs that use
600kb...

Thanks!
Sep 12 '06 #4
It all depends on your definition of "really light".

At one end of the spectrum is Assembly Language. That's gonna be pretty
light.

At the other end is Java and .Net, both of which require a very complex
runtime.

In the middle somewhere is C and C++. These two arean't always as light as
they seem - there are all sorts of runtime libraries needed depending on the
environment in which you're running.

I don't really know where Python sits, but it's probably somewhere closer to
Java and .NET than Assembly language.

--
Chris Mullins
"IsRaEl" <yz****@gmail.comwrote in message
news:11*********************@m73g2000cwd.googlegro ups.com...
Sooo..

To write really light apps i should do it directly with C++ or maybe
Python??

Greg Young wrote:
>You are not actually _using_ 7mb of memory there ... memory is allocated
in
chunks ... you then instantiate objects using bits of these chunks.. When
the application starts up it gets memory for you to use.

You also have the overhead in the runtime to contend with. Quite simply
C#
is the wrong tool to write a program with 600k of overhead.

Cheers,

Greg

"IsRaEl" <yz****@gmail.comwrote in message
news:11**********************@d34g2000cwd.googleg roups.com...
Hello Everyone..

Why when i build a REAAALY simples Console app with C#, when i compile
using the realese method and execute, it already occupies almost 7mb of
memory???

as simple as that!!
for(int i = 0; i<= 1000; i++)
for(int j = 0; j<= 1000; j++)
Console.WriteLine(i + "." + j);

How to make realy light programs...like some Google programs that use
600kb...

Thanks!

Sep 12 '06 #5
IsRaEl wrote:
To write really light apps i should do it directly with C++ or maybe
Python??
C is often significant lighter than C++.

Arne
Sep 12 '06 #6
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:9lnNg.37675$_q4.36199@dukeread09...
IsRaEl wrote:
>To write really light apps i should do it directly with C++ or maybe
Python??

C is often significant lighter than C++.
What do you base that on? C and C++ use variations of the same compiled. C++
code can compile as tightly or almost as tightly as C code. There's very
little difference in the size of the code generated. What libraries you use
may have a big impact, but there's almost none between the two languages.

Sep 12 '06 #7
Fredo wrote:
"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
>C is often significant lighter than C++.

What do you base that on? C and C++ use variations of the same compiled. C++
code can compile as tightly or almost as tightly as C code. There's very
little difference in the size of the code generated. What libraries you use
may have a big impact, but there's almost none between the two languages.
Experience.

Try compile hello world in C and C++ and compare sizes.

Libraries, templates and the OO style create bigger programs.

Arne
Sep 12 '06 #8

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...
3
by: Ian Taite | last post by:
Hello, I'm exploring why one of my C# .NET apps has "high" memory usage, and whether I can reduce the memory usage. I have an app that wakes up and processes text files into a database...
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...
13
by: Ilias Lazaridis | last post by:
How to detect memory leaks of python programms, which run in an environment like this: * Suse Linux 9.3 * Apache * mod_python The problem occoured after some updates on the infrastructure....
1
by: yzghan | last post by:
Hi all, I feel that my python script is leaking memory. And this is a test I have: log.write(" " + "test() ... memory usage: " + " ".join(repr(i/(1024*1024)) for i in getMemInfo()) + "\n") m...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
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...
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,...

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.