Just to rewrite your question, so jcl / others can understand it:

You have more or less this coding:
Code:
ent = ent_create(..)
ent_clone(ent);
while(1) {
  ent_morph(ent,...); //much faster and safer than ent_remove / ent_create combo
  ent_clone(ent);
  wait(1);
}



Additionally you have several external references to "ent", and therefore do not want to invalidate the pointer (besides it's pretty nonsense to "recreate" an entity - with all known sideeffects, e.g. restarted action, stopped functions, and slow processing).

Your question is, if:
1) With the ent_morph action, the reserved memory for the previously cloned model is freed
2) If not: Does a second call (e.g. to subsequent calls of ent_clone) free the memory of the first call?
3) If not: If there is a possiblity to free the extra memory reserved by a clone instruction after a morph instruction, without removing and recreating the entity.

correct me if i'm wrong

FYI: After a clone instruction the complete vertex / index buffer is copied. I do not think that it is possible to go "back to standard" (so releasing the changed parts). But: After a morph instruction the complete copied vertex / index buffer should be released, and your given code should not create any memory leak at all..

FYI 2: If the memory is not freed after the morph instruction, this is just a bug for me. Actually I highly doubt that ent_remove will recognize the "old" vertex buffers after some morph / clone instructions and delete them. Ent_Morph should detect if the current model is cloned, and delete the buffers accordingly if necessary..

Last edited by TechMuc; 10/16/12 08:52.