Freeing textures after you apply them to a mesh..
Blitz3D Forums/Blitz3D Programming/Freeing textures after you apply them to a mesh..
| ||
I noticed a long time ago that if you free a texture after you've already applied it to a mesh, then the mesh still remains textured, but I assume the some memory is freed? for example: tex = loadtexture("texture.bmp") entitytexture mesh1, tex freetexture tex tex = loadtexture("somethingelse.bmp") entitytexture AnotherMesh, tex freetexture tex is it bad practice to do this? |
| ||
I think the system memory texture copy is free'd immediately, and then when VRAM memory becomes short the VRAM texture is free'd. Might be wrong, but makes sense as the VRAM texture memory is 'managed' to some extent by Blitz. |
| ||
I'd imagine that texture handlers have a count or list of all objects that are using it, and that the texture isn't actually freed until there is no more references to it. Like when you CopyEntity and free the original mesh. The mesh is still needed so won't actually get freed until no other entity needs it. Just a guess. |
| ||
this is confusing, I usually just do clearworld and it turns out fine. |