- Joined
- Apr 24, 2012
- Messages
- 9,797
Does nulling Temps actually count in GUI? I mean, the pointer is replaced when the Temp is next used anyways.
Does nulling Temps actually count in GUI? I mean, the pointer is replaced when the Temp is next used anyways.
I know, but I heard the var pointer only takes up 4 bytes and does not matter since it is set to something else the next time anyways. Is that true?
I think only unit variables can be nulled in GUI.
In an instance based system where index 1 and 2 may only have been allocated once at the maximum instance period then yes. Since 1 and 2 may never be allocated again they can be considered leaks even though they are still reachable, just they never will be reached for the remainder of the session.So u doesn't leak however u[1] and u[2]/u[loop] for example can leak?
Probably because of where stuff is allocated in memory. It can only free pages that have completely nothing allocated on them. Even if a tiny 1-2 byte structure is allocated on a page it cannot be freed until that structure is freed.Also it looks like leaks are transferred from session to session/lobby/chatrooms otherwise how does it continually rise?
Since memory for wc3 usually maxes out at 1.85GB I would prefer to spend a few bytes to null a few bytes.
Dat-C3 said:Also it looks like leaks are transferred from session to session/lobby/chatrooms otherwise how does it continually rise?
Leaking is not so much a problem due to memory, but other undesirable effects. These range from greatly reduced performance all the way to crashes (not OOM). A lot of the code of WC3 uses very slow O(n) style lookups that scale badly (why map loading takes so long) so raising n is not a good idea. Additionally some resources are finite (eg the number of destructible) which once exceeded usually causes a fatal error.I understand your logic though: why waste extra bytes? However, for wc3, one has to become practical. I would rather waste that little bit of memory than bloat my code with unnecessary text. Also, the byte tradeoff isn't equal. You'll spend more bytes in your map to save a lower amount of memory.
Additionally some resources are finite (eg the number of destructible) which once exceeded usually causes a fatal error.
To each his own. When you have an 8 MB limit (for multiplayer), priorities change. Keep in mind that it is an incredibly low amount of memory. Honestly, if you end up getting even 1 MB of memory from reference counts, then you're doing something wrong. That implies that one has gone through 250,000 independent handles. Even at that, you have millions of those you can go through.
I understand your logic though: why waste extra bytes? However, for wc3, one has to become practical. I would rather waste that little bit of memory than bloat my code with unnecessary text. Also, the byte tradeoff isn't equal. You'll spend more bytes in your map to save a lower amount of memory.
Do you have proof? I'm not trying to accuse you, I am just unable to test it myself and I would like to know whether this is actually true.
DSG said:Leaking is not so much a problem due to memory, but other undesirable effects. These range from greatly reduced performance all the way to crashes (not OOM). A lot of the code of WC3 uses very slow O(n) style lookups that scale badly (why map loading takes so long) so raising n is not a good idea. Additionally some resources are finite (eg the number of destructible) which once exceeded usually causes a fatal error.