Well, to my understanding, there are three main groups of memory that we can leak using an agent:
1: the handle id. This is a 4 byte integer that cannot be reused for other objects if its reference count never reaches 0. Instead, the id is gathering dust in its slot in the hashtable (or whatever data structure wc3 uses to save used handle ids, maybe they just have some "max id" counter and an array of a static size or smthn), taking its 4 bytes of space plus additional space for the container its sitting in (if they use one; again, if they have a static array, it doesnt waste any memory at all). Its therefor a very small leak and only important if you run out of handle ids in a huge map.
2: the associated handle-data. There is not much i can think that would belong in here (reference count, type of referenced object... that's it pretty much), but looking at the c++ library, I'm sure they found lots of ways to blow this data structure up to a unnecessarily huge size. I guess comparing it to a traditional std::whatever_ptr is the wrong thing to do as it can not possibly work that way, unless every handle id is mapped to a whatever_ptr pointing to the object, which would require wc3 to delete the whatever_ptr when nulling the handle in jass, which totally defeats the point of the whatever_ptr and... you get the idea. Its probably the kind of memory that is freed once the reference counter reaches 0 and therefor the memory we leak when we don't null our local variables (claps slowly and sarcastically in blizzards direction for making such a stupid error and then not fixing it)
3: The memory associated with the actual object that the handle references. This memory should be freed when calling its Destroy function, and we can assume that it is, as using a destroyed object causes the game to crash in most cases.
I guess my first impulse when hearing "the agents memory" was to think about 3, when in fact they mean 2. The problem is, however, i don't actually know if there isn't more memory, and using the task manager to observe the memory usage merely suggests that the process frees more memory when you null it, but unfortunately doesn't really clean up the question which part of the memory is freed by which method (maybe the Destroy function is just freeing some other data, and the majority or the important data is only really destroyed when the reference count reaches 0. The pure thought made me sort of paranoid.)
yea that makes sence, but I think they could make it bound to the object itself(shared_ptr in C++ for instance)
You mean entirely removing the destroy functions and purely relying on the reference count? thanks god they didn't do that