Freeing a copied entity

Blitz3D Forums/Blitz3D Programming/Freeing a copied entity

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Add an a place where it says the number of bytes video memory left using AvailVidMem(), and see if it decreases. If you copy an entity, then you have to free all copies, but if you just copy the pointer, you can't.

Works:

mesh = LoadMesh("mesh.x")
mesh2 = CopyMesh(mesh)

FreeEntity mesh
FreeEntity mesh2


Here we just copy the pointers:

mesh = LoadMesh("mesh.x")
mesh2 = mesh

FreeEntity mesh
FreeEntity mesh2 ;THIS WILL CAUSE ACCESS VIOLATION BECAUSE HERE YOU TRIE FREEING THE SAME ENTITY TWICE (THE SAME MEMORY LOCATION)