kingkingyyk3
Visitor (Welcome to the Jungle, Baby!)
- Reaction score
- 216
JASS:
///////////////////////////////////////////////
// Hashtable Alarm ~ v1.0.1 ~
// by kingking
//
// ~ It is known Blizzard made the hashtable
// type has a limit of 256. In order to
// prevent hitting the limitation, this
// library can tell the map makers if their
// map is hitting the limitation.
//
// ~ It can also acts as the hashtable leak
// checker.
// ~ Basically a map does not requires so
// much of hashtables. But if you are
// spamming InitHashtable, then it
// may hit the limitation.
//
// How to use ?
// ~ Test your map in debug mode.
// ~ See whether it will shows the warning
// message or not.
//
// Requires : Lastest version of Jasshelper.
//////////////////////////////////////////////
library HashtableAlarm
globals
private constant integer HASHTABLE_LIMIT = 256
private integer HashtableCount = 0
endglobals
private function Increment takes nothing returns nothing
set HashtableCount = HashtableCount + 1
if HashtableCount >= HASHTABLE_LIMIT then
call BJDebugMsg("Hashtable limit is reached, null hashtable will be returned!")
endif
endfunction
debug hook InitHashtable Increment
private function Decrement takes hashtable hasht returns nothing
call SaveInteger(hasht,0,0,1)//Check whether the hashtable is flushed or not.
if LoadInteger(hasht,0,0) == 1 then
set HashtableCount = HashtableCount - 1
endif
endfunction
debug hook FlushParentHashtable Decrement
endlibrary