Ok well I'm interested in solving your problem
thing I don't get is...
Code:
a = (T *)pEntityData[ENTINDEX(pEnt)];
if (a == NULL)
{
a = new T;
if(pEntityData[ ENTINDEX( pEnt ) ])
{
if "a" is NULL then "(pEntityData[ ENTINDEX( pEnt ) ])" has got to be NULL (in the IF statement) so the IF statement is true... Yeah? Is it intended? in any case it will never free.
I never exactly had a good look at the monster plugin to see how entities were spawned, I'm guessing as you say, you are using similar code to that of it?
What exactly are you wanting to do (in the long run)? I'm sure there maybe an easier way to go about doing it.