MEMORY not Releasing

Posted By: WINBERRY

MEMORY not Releasing - 04/29/14 14:54

I am using A8, and working on a Terrain game where various images are displayed as the player moves across terrain. All is fine, except, it runs out of memory (F11/Memory MB/ ent - keeps increasing by 4 with every new ENT or BMAP even though both are removed, ie: starts at 16, keeps adding 28,32,36,etc. and I can find no way of getting the Memory/ent back down to start size

ALSO, seems *.PNG files are the biggest problem - is there a special way to display PNG? Should TGA be used instead?

Any help appreciated

thanks!
Posted By: jcl

Re: MEMORY not Releasing - 04/29/14 15:01

I can't comment on the BMAP problem, but for removing recently loaded entity files from the level cache there are the level_mark and level_free commands.
Posted By: WINBERRY

Re: MEMORY not Releasing - 04/29/14 17:06

thanks, I tried that but can['t see a change:
I create an ENTIY*
assign it to an ent_create()..
...
then remove it: I have tried removing with ent_remove,ptr_remove, ent_purge
(you can see Im just stumbling around here...)

still the F11/Memory/ent increase by 4 with every run of that function
Posted By: Superku

Re: MEMORY not Releasing - 04/29/14 17:42

Post the relevant code then.
Posted By: WINBERRY

Re: MEMORY not Releasing - 04/29/14 19:06


Wie Gates! und Danke....



ENTITY* myGIANTimage;
function imageGiants()
{
myGIANTimage = ent_create("GIANTS1.png",vector(0,0,0),placeGiants);
}
action placeGiants()
{
wait(-4);
removeGiants();
}
function removeGiants()
{
wait(1);
//ent_purge(me);
//ent_remove(me);
ptr_remove(me);
}

*/

Every time I use this function MEMORY/ent += 4 -- and within a few minutes, ERROR: Out of Memory

thanks

P.S. I hope I posted this code appropriately...
Posted By: sivan

Re: MEMORY not Releasing - 04/29/14 19:45

as I remember png is loaded by directx and not by an engine function and not recommended, earlier I had some problems with it. does the same happen with tga or dds?
Posted By: WINBERRY

Re: MEMORY not Releasing - 04/29/14 20:03

Yes, I have tried *.PNG, *.BMP, *.TGA, they all do the same thing...I don't remember having this issue before...could it be my current release of A8?
Posted By: WINBERRY

Re: MEMORY not Releasing - 04/29/14 23:53

..well, I just created a LEVEL game using *.PNG, and though the MEMORY/ent rises, it also falls resulting in steady memory... sorry for the miss guide on the PNG, I haven't figured out what the main memory issue is (and I did reload GStudio 7.9 just to check - same issue with same program), but thanks for the help-much appreciated!
Posted By: WINBERRY

Re: MEMORY not Releasing - 05/01/14 00:28

FYI: Here is what I found to fix "leak"


wait(1);
ent_purge(me);
ent_remove(me);
wait(-2);

NOTE: this DID NOT WORK

ent_purge(me);
wait(1);
ent_remove(me);
wait(-2)

Seems I had to both purge the mem and remove the ENT at the exact same time.
Just putting the wait(1) between, allowed the MEMORY/ent to add onto itself

ALSO: I played with the wait(-2) which seemed as low as I could go without out leaking again.

Don't know enough to know why, but I posted this in case it can help someone else..
Posted By: jcl

Re: MEMORY not Releasing - 05/05/14 10:25

Wait() has nothing to do with releasing memory. If your second version did not work, then the entity was probably still rendered in the level, and thus the purged video memory was immediately allocated again.
© 2024 lite-C Forums