Memory leak in ent_clone ?

Posted By: 3run

Memory leak in ent_clone ? - 02/06/20 12:55

Hi!
Code
void main()
{
	level_load("");
	ENTITY *test_ent = ent_create(CUBE_MDL, nullvector, NULL);
	ent_clone(test_ent);
	ent_morph(test_ent, SPHERE_MDL);
}

and acklog.txt
Quote
acknet.dll opened
ackoal.dll opened
ackphysX.dll opened
Compiling TEST.C - [Esc] to abort.......... 0.085 sec
Running TEST.C.
2 objects
Main started at 1.165
D3D_Init Window: 720x480 -> Window: 1x720x480x32
Video memory found: 4093 MB
LevelInit at 1.223 0 lmaps 0 textures...ok
LevelReady at 1.224
def_startup started
Main loop at 1.232....
1st frame with 4093 MB. at 1.235
Normal exit at 1.682
Close level,DLL,objects
Free input,funcs,panels,defs,syns,views,strings,vars..ok
Free sounds,bmaps,fonts,hash,defs1,script..ok
Close dx,multimedia,D3D,engine,nexus..ok
A8 Engine - Pro Edition V8.47.1 - Mar 9 2016
(c) Conitec - www.3dgamestudio.com
Registered to: Magomet Kochkarov
Unfreed: 1078, CLO, 288 bytes
Unfreed: 1079, CLO, 476 bytes
Close window at 1.695

Am I the only one getting this memory leak?

Edit: new level_load doesn't help.. removing entity and level_load doesn't help...
Edit2: ent_cloneskin seems to be fine, only ent_clone is causing memory leaks

Best regards!
Posted By: txesmi

Re: Memory leak in ent_clone ? - 02/06/20 16:51

Hi 3run,
I am afraid you missed the following manual entry in 'ent_clone'

Quote
A cloned entity must not be cloned a second time or ent_morphed, otherwise its cloned mesh and skin are 'orphaned' and not released from memory.


Salud!
Posted By: 3run

Re: Memory leak in ent_clone ? - 02/06/20 17:51

Ohh.. I missed that one indeed grin Thank you for pointing this out man! You are always helpful! laugh

Best regards!
© 2024 lite-C Forums