Freeing a copied entity

Blitz3D Forums/Blitz3D Programming/Freeing a copied entity

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)