Operative memory again [solved]

Posted By: VeT

Operative memory again [solved] - 07/23/09 11:46

Jcl, please, do something...
While project wasnt so large, i just rebooted SED one or two times per some hours
Now project is lot bigger and Task Manager says:
SED, just launched - 21 Mb
SED, application launched for the first time - 207 Mb
SED, application is closed - 159 Mb

SED, application launched for the second time - 327 Mb
SED, application is closed - 281 Mb

and so on, so i must reboot SED every 5-10 minutes.. its impossible to work now...

In addition, i dont know, why application eats so many memory: i almost didnt add new models, just works on gameplay... what can you advice?
Posted By: EvilSOB

Re: Operative memory again - 07/23/09 12:16

Does your project use any plugin dll's that maybe arent being "closed" by your project?
Posted By: VeT

Re: Operative memory again - 07/23/09 12:33

yep:
GSVector.dll - 516 Kb
Format_C.dll - 95 Kb
Posted By: jcl

Re: Operative memory again - 07/23/09 13:32

When some part of your app causes memory problems, the first thing I'd do is finding out which part, and which function is responsible for that. For this, first strip down your app until the problem goes away, then add function after function until the memory problem appears again.
Posted By: VeT

Re: Operative memory again - 07/23/09 13:34

Heh... there are so many of them... can you add additionfl info about functions to engine_gettaskinfo() ?
For example, how many memory it eats ?
Posted By: TechMuc

Re: Operative memory again - 07/23/09 14:41

function main()
{
sys_exit("");
return 0;
}

replace your main function with this code, and check the memory usage of SED :-)
Posted By: VeT

Re: Operative memory again - 07/23/09 14:44

The same as in my first post :P
Posted By: TechMuc

Re: Operative memory again - 07/23/09 14:49

just my own frightning memory-checking results..

NORMAL project start/restarts
Code:
no start: 12.760 MB
1: Start (running): 205
2: Close Engine   : 143 (!!!)
3: Start (running): 316
4: Close Engine   : 255



Project with replaced main function. no startup function existend
Code:
no start: 12.754 MB
1: Start (running): 154
2: Close Engine   : 138
3: Run again      : 265
4: Close again    : 249




EMPTY Project (just include acknex.h / default.c)
Code:
no start: 12 MB
1: Run Engine: 45 MB
2: Close Engine: 29 MB
3: Run Engine: 58 MB
4: Close Engine: 39 MB
5: Run Engine 65 MB
5: Close Engine: 49 MB



==> Even with an empty project (#include <acknex.h>\n#include<default.c> i also expierence a memory-increase of 10 MB per run.

ha gladfully I'm working with mvc++ smile
Posted By: VeT

Re: Operative memory again - 07/24/09 13:27

Originally Posted By: EvilSOB
Does your project use any plugin dll's that maybe arent being "closed" by your project?


Anyway, what is the correct method of closing DLL's ?
Posted By: VeT

Re: Operative memory again - 07/24/09 13:39

Originally Posted By: TechMuc
function main()
{
sys_exit("");
return 0;
}

replace your main function with this code, and check the memory usage of SED :-)


BTW, i have only one "_startup" function for debug reasons... so why that code loads so many memory? In a sum, i have 164 Kb of code.
Posted By: EvilSOB

Re: Operative memory again - 07/24/09 14:03

Its up to the dll, like your newton doesnt like the engine closing with
the newton dynamics still active.

That sort of thing...

But I think that idea is ruled-out by Techmuch's tests.
They look pretty damning for SED...

Posted By: VeT

Re: Operative memory again - 07/24/09 14:28

I had the same results and printed them on the forum some time ago... so, we are waiting for Jcl smile
Posted By: jcl

Re: Operative memory again - 07/27/09 12:47

If it happens with any script on your PC, it should also happen with any of our scripts, which is not the case - in fact we never observed this except for the mentioned compiler memory consumption. But we'll make another attempt to reproduce it, maybe it depends on a certain configuration.
Posted By: VeT

Re: Operative memory again - 07/27/09 14:02

Yes, but at least it was possible to work before, when i needed to restart SED some times per hours... bot now i may restart it every 10 minutes

Okay, i'll wait and hope that you'll deal with this.
Posted By: jcl

Re: Operative memory again - 07/30/09 12:33

Ok, we spent one day running Techmuc's minimum script on a large variety on machines, several SED and engine versions, and with professional debugging tools. We could never see any memory leak, except for the mentioned leak in debug mode. We also had SED run overnight under remote control and permanently started that script. After about 10,000 runs, the memory allocation was still exactly the same.

So in short, we are not any wiser than before.

Maybe you're always running in debug mode?
Or still using something in your script that does not free its allocated memory?
Posted By: VeT

Re: Operative memory again - 07/30/09 12:51

//Ok, we spent one day running Techmuc's minimum script on a large variety on machines, several SED and engine versions
Thank you for your attempts to fix this.

Okay, i'll also try exactly his script, wait a little.
Posted By: bart_the_13th

Re: Operative memory again - 07/30/09 13:04

Well mine also has that same problem. SED increases memory usage everytime I run my scripts but somehow it depends on the memory used by the scripts.
For example, each time I run my dinoisland, the memory usage increase about 30Mb, while some example almost no significant increment. The solusion is just simple, I quit SED then restart it again... Maybe some kind of memory leak...

Well since I use LLiteC Free which is free, I have no complain though...
Posted By: VeT

Re: Operative memory again - 07/30/09 13:17

Okay, i created new folder, added new empty file test.c, add there
Code:
///////////////////////////////
#include <acknex.h>
#include <default.c>

///////////////////////////////

function main()
{
  vec_set(screen_size,vector(800,400,0));
  vec_set(screen_color,vector(50,1,1)); // dark blue
  vec_set(sky_color,vector(50,1,1)); // dark blue
  video_window(NULL,NULL,0,"My New Game");
  d3d_antialias = 1;
  shadow_stencil = 3;
  
  level_load(NULL);
  vec_set(camera.x,vector(-250,0,50));
  vec_set(camera.pan,vector(0,-15,0));
}



1)
AnVir shows that SED eats 20.5 Mb (sorry, i dont have more proffesional tool smile )
I press "Run current script" button, now SED is 20.7 Mb
Close game window: 20.7

Close SED and launch again : 20.1 MB (???)
Hm... okay, now i add test.c to Main Script and press Test Run, 22.3 Mb (what???)
Close window, now its still 22.3 (even i dont expect this)

Reboot SED: 20.1 (heh, thats good)
Debug Run: 44 Mb (wtf ?!?!)
Close Engine: 36.4 Mb
Debug run again: 53Mb
Close Engine: 45 Mb

2) Lets look deeply
Reboot Sed: 20.1 Mb
Run Current Script: 20.2 (i'm really happy that you add this button smile )
Close window: 20.2 Mb
Run Current Script: 20.2 Mb
Close engine: 20.2 Mb
***
Yep, "Run Current Script" creates new acknex.exe and dont disturb SED.exe - thats real smile

Reboot: 20.1 Mb
Test run: SED.exe - 20.3 Mb, acknex.exe - 26 Mb
Close acknex: SED.exe - 20.3Mb
Test run: SED.exe - 20.3 Mb, acknex.exe - 26 Mb
Close acknex: SED.exe - 20.3Mb
***
Looking like stable: SED.exe didn't eat more memory, but what was that on the first launch?

I think that debug is no need to test as you said that its known leak


Hey, i got new idea: sometimes, when i perss F5 after placing some breakpoints, i run Debug mode, and sometimes test mode... Can you check that? In addition with the "engine runs before scripts save" problem?

Edit: if only i would get this, i'd think that AnVir dont work properly or something like that... but it happens not only to me..

Posted By: VeT

Re: Operative memory again - 07/30/09 13:19

Originally Posted By: bart_the_13th
The solusion is just simple, I quit SED then restart it again...

Exactly, but now, as you have not too large project, you are need to restart SED one time per some hours, and while your project would be large enough, you'd be needed to restart it every 5-10 minutes... I hope, we'll find, where is the problem and Jcl would fix it.
Posted By: VeT

Re: Operative memory again - 07/30/09 14:30

Yes..
Test Run is F5 (as it is said in menu in SED)
When i press Test Run button, all works fine (ist acknex.exe created and the size of SED.exe is stable), but when i press F5 key, Debug Run is activated and SED begin to eat too many memory without releasing... I think you can fix this easily smile
Posted By: TechMuc

Re: Operative memory again - 07/30/09 14:39

At first thank you very much for your spended time.
Just in case there's a total missunderstanding between us, I've recorded a screen-capture (only 2MB!) of my understanding of the "Memory Leak" of SED:

Please have a look at the following video:

SED-Memory-Video

the video is taken with the latest Lite-C SED, so anyone is able to test it, but the behaviour is the same with the latest official version.
You clearly see the memory increasing in the demo (as well in the Task-Manager as in ProcExp) ~10 MB per run.

BTW: to speed things up i can also interupt the engine WHILE loading/compiling (pressing the red stop button) resulting in the same memory-leak. ==> With this method i'm able to let SED reserve + 1GB in less than 2 minutes.
Posted By: VeT

Re: Operative memory again - 07/30/09 14:44

Yep, debug mode eats too many memory... And its binded to F5 key, if i'm right smile

... and Ctrl+F5 calls Test Mode and there is no memory leaks anymore!
In the menu they are changed:


Just bind Test Run to F5 and Debug Run to Ctrl+F5
Posted By: TechMuc

Re: Operative memory again - 07/30/09 14:51

just in case the video is too big for your monitor, a smaller version without ProcExp

SED-Memory-Video
Posted By: jcl

Re: Operative memory again - 07/30/09 16:13

VeT: That's exactly the same results that we also had.

The reason of the problem was simply that your SED apparently has F5 assigned to Debug Run. The keys shown in the menus are only the default assignments, not the current assignments. So when pressing F5, you were probably starting a debug session all the time. Then the memory gets used up soon.

You can change the assignment in Options / Customize Hotkeys.

The different values on SED's first and second start came from memory fragmentation. This is absolutely normal.

Thus, I think the mysterious memory issue is now finally solved.
Posted By: VeT

Re: Operative memory again - 07/30/09 17:27

Yep. Thank you for your time smile

//You can change the assignment in Options / Customize Hotkeys.
Can you set this by default? Its not hard for me to change, but for others, who don't see this topic, it would be usefull.


//The different values on SED's first and second start came from memory fragmentation. This is absolutely normal.
Understood.

But what about Debug Run? Would you improve it in the nearest time?
© 2024 lite-C Forums