The online racing simulator
.Net Madness
1
(36 posts, started )
.Net Madness
I realy am shocked...I woke up early this morning and felt bored. So i began learning C++. I was looking at some basic code and i felt like a test to see JUST how bad the .Net is for memory. So i made a simple project and called it "Firstproject" this 1 was in C++.Net/CLR. The code i used below was the same piece for both programs.
cout<<"Hello world";

Now i loaded that up and looked at my memory in task manager. Looked to find that 1 line of code was using 8MB!!!!!! i then loaded a new project (Win32/Standard C++) done the same piece of code in that. Loaded the program...it was using less then 1mb. Id realy love to know why .Net does take so much. I know it handles garbage collection and memory but on 1 line of code using 8mb is just CRAZY. I realy am going to continue learning C++ now and try a leave the .Net behind......
As far as I know the memory is just reserved, not actually used. You can force it to reduce the working set size to what it actually needs, but what's the point? Judging anything about .NET with such kind of test is ridiculous.
Probley might be a stupid test but do you not see what im saying? its a bit weird why the .Net use's so much memory for silly reasons.
But maybe if you had a program that needed 8mb of ram, .Net would still only use 8mb? I think you need to do more tests, and more reading of the internal architechure of .net. And this is from a non-programmer (I tried, but I was rubbish - I have a complete inability to learn other languages, both written, verbal and computer)!
O Holy Mother of Benchmarks deliver us.

On a more serious note, if you Google for benchmarks and memory-consumption-related articles you can find out all about it with some slightly more complex tests.
pfft...last time i ever post something on this forum programming related......:flamed::irked:
Seriously, what did you expect? Damn Microsoft for not optimizing the memory print of hello world applications?
Quote from mcgas001 :pfft...last time i ever post something on this forum programming related......:flamed::irked:

Well, let's just say this is a much milder reception of such an announcement than what you'd get in a programming-related forum (if you even got one).
breaking news, .net = bloat
Breaking news:

(Code size) : (Compiled size) ratio is almost always bigger for ridiculously small amounts of code. Hurrah.
The task manager does not show how much memory a program is using, it shows how much memory Windows has allocated to that program. This memory is often shared with other processes, such as the .NET CLR, and also leaves room for future expansion. Also Windows will free that memory is it needs to, or start paging it. As someone said, .NET is not optimised for Hello World programs, it's optimised for large scale enterprise applications.
I know im now hated for making my personal opinion public but oh well...thats the nature of some people on this forum..

Someone mind defining "large scale enterprise applications"
Your personal opinion? It wasn't an opinion, it was the result of a very very very poor single test. And you're not hated now, you've just be ridiculed for the above test. Get over it.

Large Scale Enterprise Applications = (probably) full blown commerical applications I'd imagine, not <1mb .exes
Who exactly hates you? I don't and I don't think anyone who posted in this thread does.

Quote :Enterprise level software is software which provides business logic support functionality for an organization, typically in commercial organizations, which aims to improve the organization's productivity and efficiency.

Services provided by enterprise software are typically business-oriented tools such as online shopping and online payment processing, interactive product catalogue, automated billing systems, security, content management, etc.

http://en.wikipedia.org/wiki/Enterprise_software
Knew i should have gone for VB.............
bleh, i know what he means...
it's the inability to program effectively.
Like back in the early days, where you had to know HOW to program.
For example, google for "100k intro's"
The problem is the high-level languages (my opinion), so basically, why bother optimizing the code for a certain problem, just wait for the next generation of computers... they'll crunch it certainly.
thus producing inflated code that was easily written/clicked together and runs like "hammer on the head".

<<< puts flamesuit on...
I wasnt flamming i was just totally shocked when i saw the amount of memory the .Net acutally used. I code in the .Net :s kinda makes my a hypocrit

Sorry.. :s
Like with all things, you weigh the pros and the cons - the extra features vs the burdens that come with them and you decide what to use. Nothing comes for free and there's always a trade-off and the bartering asset is always time in the end - and we all have a finite amount of that.
Programming has changed a lot in twenty years, programs today are much more complex that those of the past. You have to have tools that ease the development process. It's up to you to decide if you want to use them or not.
Well if you want low memory usage and high speed, you should use plain C(++), not a language that uses some sort of virtual machine.
But don't come back crying you've just made a massive memory leak and can't find it
Quote from micha1980de :bleh, i know what he means...
it's the inability to program effectively.
Like back in the early days, where you had to know HOW to program.
For example, google for "100k intro's"
The problem is the high-level languages (my opinion), so basically, why bother optimizing the code for a certain problem, just wait for the next generation of computers... they'll crunch it certainly.
thus producing inflated code that was easily written/clicked together and runs like "hammer on the head".

<<< puts flamesuit on...

I'd agree with that. I'm no programmer, but seeing how huge programs are getting for very little improvement in features, ease of use, or speed is very annoying. Back in the day (and I know it's not really comparable, but hey, who cares) there was DOS on a floppy, Windows 3 on three, and something like Elite 2 on a couple of floppies. That's @15mb for an operating system, a GUI and a game with millions of planets, music etc...
Quote from kingfag :Well if you want low memory usage and high speed, you should use plain C(++), not a language that uses some sort of virtual machine.
But don't come back crying you've just made a massive memory leak and can't find it

If you program propley that wont happen...
If they never created new technologies, new languages and tools, we'd all still be plugging machine code into the memory by hand, and this forum wouldn't exist.

Anyway, no one has been able to prove that a program written for .NET actually uses more memory than one written in C++, also it's not true that .NET programs take up more space on the harddisk (in fact the opposite is generally the case), so the whole argument is a bit pointless really.
Quote from DarkTimes :
Anyway, no one has been able to prove that a program written for .NET actually uses more memory than one written in C++, also it's not true that .NET programs take up more space on the harddisk (in fact the opposite is generally the case), so the whole argument is a bit pointless really.

I guess thats kinda right, like i say i was a little shocked. Maybe having less then 2 hours sleep for 1 night doesnt help

Edit: Nice post count DarkTimes
There, I've made a completely useless app that uses as little memory as possible.
using System;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace MemUsageTest
{
class Program
{
[DllImport("kernel32.dll")]
public static extern bool SetProcessWorkingSetSize(IntPtr proc, int min, int max);

static void Main(string[] args)
{
Console.WriteLine("Before workingset size trimming");
Console.ReadLine();
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1);
Console.WriteLine("After trimming");
Console.ReadLine();
}
}
}

It doesn't prove any point, but at least you can now make your program use "much less memory". Of course it will be slower as soon as it has to request that memory back from the system, but who cares about that...
Attached images
workingset.png
1

.Net Madness
(36 posts, started )
FGED GREDG RDFGDR GSFDG