Autor Tema: windows memory managment and the taskmanager  (Leído 3355 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
windows memory managment and the taskmanager
« en: Agosto 31, 2012, 07:07:31 am »
I noticed something interessting with it's memory usage when running malvado with demo for a good length of time. In the windows task mangager I always check occasionally how much memory it's using, and if I run it for a short time (about 10 minutes or less) the memory use is increasing and I was under the impression that I have a memory leak somewhere.

But now I've run the demo for a few longer sessions (today for a couple of ours straight) and I noticed that the memory usage increase stops at around 65-70mb, and then drops to about 12mb after about 30-45 minutes. From that time on the memory usage varies between about 12mb - 18mb. The attractmode runs 5 different level demos, and use the actual game engine. What I find strange is how bgdi/malvado initially needs about 70mb and later only about 18mb for doing the same thing over and over.  It looks like a sawhtooth pattern almost if you where to draw it on a graphpaper.

Now I wonder if windows' taskmanager gives a representive figure on the acutal memory use. I've read somewhere http://stackoverflow.com/questions/131303/linux-how-to-measure-actual-memory-usage-of-an-application-or-process that the ps command in linux doesn't show the correct figure in all cases. I'm under the impression that windows reserves a rather large chuck of memory and then decides to free a large part of it to a size more in line with the programs actual memory usage.

Can someone explain this phenomenon or has similair experiences? I find it quite strange and it learned me that you need to run a program for a couple of hours if you want to know if there is a memory leak or not. Just doing this test made me rule  out the likeness of a memory leak.

O btw,  the demo runs pretty well and is very stable. :) I fixed a really hard bug with jumping on platforms and now it's working nicely. There are a few small minor things but those are not really worth fixing right now.

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12375
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:windows memory managment and the taskmanager
« Respuesta #1 en: Agosto 31, 2012, 07:30:00 am »
you generate a stub binary? I mean, you compile with -s? or/and with -a?
« última modificación: Agosto 31, 2012, 07:33:07 am por SplinterGU »
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:windows memory managment and the taskmanager
« Respuesta #2 en: Agosto 31, 2012, 09:56:50 am »
Yes, always. Common practice for me so that I can use the debug window (I also do this for DoctrorN's projects). I know it's not really needed for the game, but for the editor it's handy. I like the use of the Alt-X as panic button.
« última modificación: Agosto 31, 2012, 09:59:16 am por handsource-dyko »

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12375
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:windows memory managment and the taskmanager
« Respuesta #3 en: Agosto 31, 2012, 10:38:18 am »
don't use -a and -s if you want reduce the memory use...

when you use -a and -s you create an executable that is very huge, this executable is loaded by the SO in memory... then you use 80mb or more when you start it...

I suggest you that you use only -a for dcb, but no add it to executable.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:windows memory managment and the taskmanager
« Respuesta #4 en: Agosto 31, 2012, 10:57:58 am »
Ok. Thanks. I never realised that the debugger would add so much memory overhead. Well for the editor it's not really a big issue for me since it only has to run on pc's and they have plenty of memory these days, but with the game itself I'll defenitly take it into account because I challange myself to make malvado more efficient in relation to it's content size.

 I want to rewrite the editor and the level rendering part to make it more efficient in disk size and memory usage. Right now I have two editors side by side, one for designing the backgrounds and hardness maps, and the main editor to place the enemies and the rest. I have plans to combine them into one (also the data structures), and the game engine can benefit from this (in the future).

But, I am doing this graduatly, it's just a part of an ongoing refactoring and maintance process. The new demo implementation is the third (and final) implementation of the demo mode in malvado. I have wanted to it this way the first time but for practical reasons I implemented it in an easier way (with screendumps) first. Now it's exactly the way I like it: small in disk and memory usage, and using an old skool method.  ;D But It took some time to cook.

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12375
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:windows memory managment and the taskmanager
« Respuesta #5 en: Agosto 31, 2012, 11:00:03 am »
no, no debugger...

I mean, add all resources (graph files+sounds+other files) to dcb, and add dcb to .exe.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:windows memory managment and the taskmanager
« Respuesta #6 en: Agosto 31, 2012, 11:30:35 am »
Oh, no I don't usually add resources to the dcb. I'll keep them seperate.

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12375
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:windows memory managment and the taskmanager
« Respuesta #7 en: Agosto 31, 2012, 11:52:43 am »
then I don't know why you consume 80mb of ram...

sorry for the misunderstanding...
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:windows memory managment and the taskmanager
« Respuesta #8 en: Septiembre 01, 2012, 08:05:16 am »
I compiled without any options now (also without debugger) and I still get the same behaviour oddly enough.

Conectado SplinterGU

  • Hero Member
  • *****
  • Mensajes: 12375
  • Karma: 366
  • Sexo: Masculino
    • Ver Perfil
Re:windows memory managment and the taskmanager
« Respuesta #9 en: Septiembre 01, 2012, 08:15:36 am »
no bennugd issue... or you code do something with memory or windows issue...

try with a hello world in bennugd.
Download Lastest BennuGD Release: http://www.bennugd.org/node/2

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:windows memory managment and the taskmanager
« Respuesta #10 en: Septiembre 05, 2012, 10:44:13 am »
In linux my program behaves differently. There it seems to leek memory, and after more then an our it's using 200+ mb of ram. In windows the memory drops after some time, but in linux it doesn't seem to do that. Quite strange this difference.

In windows I'm using version 1.00 jul.9, 2012 and in linux version 1.00 jan. 20, 2011.
Malvado uses the let_me_alone function in it's main routine, to keep one the main control process alive. I've checked if I haven't forgotten any fpg unloads, but these and other resources seem fine in that aspect.

Desconectado handsource-dyko

  • Hero Member
  • *****
  • Mensajes: 568
  • Karma: 32
  • Sexo: Masculino
  • I'm the eye in the sky.
    • Ver Perfil
    • dyko designs
Re:windows memory managment and the taskmanager
« Respuesta #11 en: Septiembre 11, 2012, 10:12:42 am »
I noticed something funny today: If you minimize and then maximize the bgdi application window, I see the memory usage in the taskmanager change for 200mb (or any high number) to only a few megabytes. I am thinking that the windows task manager (but also top and ps and the gnome task monitor) are not showing the actual memory usage properly. It almost looks like that they count the memory over the runtime and only refresh the number when you minimize and maximize a window a few times rapidly.