clean up MiniB3D - memory leak?

BlitzMax Forums/MiniB3D Module/clean up MiniB3D - memory leak?

SteAbra(Posted 2007) [#1]
Hi,

i have serious problems to clean up the memory.
i need to call Graphics3D in different resolutions as an dll function.

here is a simplyfied example:

----------------------------------------------------------------------

Import "minib3d.bmx"
Framework brl.blitz

Repeat
Init_3D()
DebugLog "mem " + GCMemAlloced()
key = WaitKey()
Until key = KEY_ESCAPE


Function Init_3D()
Graphics3D(400,300,32,2)
Local cam = CreateCamera()
Local cube = CreateCube()
PositionEntity cam,0,1,-4
PointEntity cam, cube
RenderWorld()
Flip
FreeEntity cam
FreeEntity cube
End Function

----------------------------------------------------------------------

i used FreeEntity to clean my 3D World, but the memory is still increasing after each call. Any Ideas?

Thanks

Stephan


McSeb(Posted 2007) [#2]
lol, was complaining about the same thing a while ago... Read my post, it should help:

http://www.blitzbasic.com/Community/posts.php?topic=68869


simonh(Posted 2007) [#3]
At the top of FreeEntity if you replace:

RemoveLink link

With

ListRemove(entity_list,Self)

It seems to fix a mem leak. Not sure why that is yet.

Note as well that if you are converting objects to ints like in the example above, you will have to use Release with the int to avoid mem leaks.

Probably better just to use objects, i.e.

cam:TCamera=CreateCamera()