Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: MyndFyre on July 21, 2004, 06:21 PM

Title: Windows Forms Memory Consumption
Post by: MyndFyre on July 21, 2004, 06:21 PM
I've become very conscious about how much memory my bot uses (about 40mb by the time the bot loads).

I decided to do some testing:

Baseline (one window, no child controls):
      13,984k debug, 13,680k release

Baseline plus use of my library:
      14,336k debug, 14,200k release

Baseline console:
      6,580k debug, 6,356k release
Console plus use of my library:
      7,176k debug, 7,004k release

The "Baseline" test is an unmodified, brand-new C# project with a single, blank form called "Form1".  Adding my library to it, I added a class which implemented the interface IConnectionSettings, which forced the runtime to load my library.

The "Baseline console" test was a brand-new console application.  When I added my library to it, I implemented the IConnectionSettings interface on Class1, where the entry point was.

Somewhat scary....
Title: Re:Windows Forms Memory Consumption
Post by: Banana fanna fo fanna on July 21, 2004, 10:10 PM
Wow, that's really bad. Can you do the same benchmark on a native API Windows app, and MFC?
Title: Re:Windows Forms Memory Consumption
Post by: Maddox on July 29, 2004, 12:01 AM
My native C++ bot runs under 300K when idle sometimes.
Title: Re:Windows Forms Memory Consumption
Post by: hismajesty on July 29, 2004, 09:19 AM
Since iago is off camping..."JavaOp takes 600k"
Title: Re:Windows Forms Memory Consumption
Post by: iago on July 29, 2004, 02:20 PM
As long as I'm not using a gui, I've seen my Java bot as low as 300k and as high as 1.2mb, but it tends to level off at about 600k :D
Title: Re:Windows Forms Memory Consumption
Post by: Falcon[anti-yL] on July 30, 2004, 01:49 AM
The lowest I got with Armabot was 13mb after leaving it on for a day, then soared all the way to 80mb when I used the log viewer :-\
Title: Re:Windows Forms Memory Consumption
Post by: MyndFyre on July 30, 2004, 12:00 PM
Quote from: Falcon[anti-yL] on July 30, 2004, 01:49 AM
The lowest I got with Armabot was 13mb after leaving it on for a day, then soared all the way to 80mb when I used the log viewer :-\

Is that all?  I've had well over 100mb when using the log viewer.  :-P
Title: Re:Windows Forms Memory Consumption
Post by: Falcon[anti-yL] on July 30, 2004, 12:24 PM
The log viewer took so long to view so instead of watching its memory usage increase I just ended the process. I had TFT minimized so all that memory consumption lags up my sister :( I'm sure If I had left it on it would've went over 100mb ;)
Title: Re:Windows Forms Memory Consumption
Post by: Banana fanna fo fanna on July 30, 2004, 03:16 PM
That's TERRIBLE!
Title: Re:Windows Forms Memory Consumption
Post by: TheMinistered on August 03, 2004, 09:14 AM
Hey, myndfyre-- what project configuration were those tests done on?  If you set the configuration to Release, you will get better memory consumption, it's still bad-- but it's better.
Title: Re:Windows Forms Memory Consumption
Post by: Banana fanna fo fanna on August 03, 2004, 10:23 AM
40mb is still unacceptible.
Title: Re:Windows Forms Memory Consumption
Post by: MyndFyre on August 03, 2004, 12:45 PM
Quote from: TheMinistered on August 03, 2004, 09:14 AM
Hey, myndfyre-- what project configuration were those tests done on?  If you set the configuration to Release, you will get better memory consumption, it's still bad-- but it's better.

Emphasis added for people who can't read:

Quote from: Myndfyre on July 21, 2004, 06:21 PM
Baseline (one window, no child controls):
     13,984k debug, 13,680k release
Baseline plus use of my library:
     14,336k debug, 14,200k release
Baseline console:
     6,580k debug, 6,356k release
Console plus use of my library:
     7,176k debug, 7,004k release
Title: Re:Windows Forms Memory Consumption
Post by: MyndFyre on August 03, 2004, 12:46 PM
Quote from: $t0rm on August 03, 2004, 10:23 AM
40mb is still unacceptible.

Agreed.  However, I think all things considered, 15mb is not.  I am limited by the technology I am using; if its baseline is 14mb, then my goal is 15-18mb.
Title: Re:Windows Forms Memory Consumption
Post by: Tuberload on August 03, 2004, 02:43 PM
Yes, and it sounds like this technology is not so great right this moment.
Title: Re:Windows Forms Memory Consumption
Post by: TheMinistered on August 03, 2004, 09:15 PM
A base-line window uses ~6mb and base-line console uses ~5mb for me, perhaps your tests are faulty.
Title: Re:Windows Forms Memory Consumption
Post by: MyndFyre on August 03, 2004, 10:37 PM
Quote from: TheMinistered on August 03, 2004, 09:15 PM
A base-line window uses ~6mb and base-line console uses ~5mb for me, perhaps your tests are faulty.

What runtime version?
Title: Re:Windows Forms Memory Consumption
Post by: K on August 03, 2004, 10:37 PM
on .NET 1.1, a debug System.Windows.Form uses 10mb for me, and a release ~7mb.  I have 512mb of RAM, in case that's any way related.

Edit: I was about to test on 2.0 beta, but I haven't restarted since I installed it so I can't.  And now I'm sleeping.
Title: Re:Windows Forms Memory Consumption
Post by: Banana fanna fo fanna on August 03, 2004, 10:56 PM
I'm a big hypocrite, using .NET, Java, and Python...but I think that bloatware is a HUGE issue.

Has anyone noticed Windows just slowing down after time? Even if you keep it spyware-free? I have a P3 550mhz box which is running win2k, and it can barely handle Opera.
Title: Re:Windows Forms Memory Consumption
Post by: Falcon[anti-yL] on August 03, 2004, 11:05 PM
My XP Pro has been running for about 2 weeks and I don't notice anything.
Title: Re:Windows Forms Memory Consumption
Post by: hismajesty on August 04, 2004, 12:32 AM
Alright, I've had a theory for a while that Microsoft didn't mind the memory consumption when developing .NET because, a few years down the road 500gb harddrives will be normal, >=1gig ram, etc. Just look at history, 10 years ago people had 4mb of RAM, even 4 years ago computers were still being built with 5 gb harddrives. Now people have 256-512mb shipped with stock computers, and 60-120gb harddrives.

Anyway, I've been conversing with Robert Scoble through email for the past month and I decided to ask him about my theroy, I'm assuming it's pretty close to the real reason. Here was his reply:

QuoteYeah, that's sorta how Microsoft's developers think. They look at what the hardware is going to look like in three years and they develop features that'll take advantage of that hardware (and give them productivity so they can develop things in less and less time).
Title: Re:Windows Forms Memory Consumption
Post by: Banana fanna fo fanna on August 06, 2004, 11:01 AM
Quote from: Falcon[anti-yL] on August 03, 2004, 11:05 PM
My XP Pro has been running for about 2 weeks and I don't notice anything.

Mine for 2 months.

I'm talking about a P3 550mhz that I bought 3 years ago. It ran all of its apps and such perfectly fine. I reformatted and installed the same apps....and now it's slow.