Alloc funciton is limited to less than 1000 handle. I tried to allocating 87142 handle and it is crashed, it seems to be the handle table used is minimum, changing it to globalalloc and everything went fine again.
I'd suggest this for replacement
mAlloc proc nSize:dword
add nSize,4
invoke GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,nSize
.if eax==0
invoke MessageBox,NULL,CADD("Unable to allocate memory"),NULL,MB_OK
.endif
ret
mAlloc endp
QuoteI tried to allocating 87142 handle and it is crashed
:eek
i am surprised you got to 87141 :lol
allocate fewer large blocks, then split them up with pointers
I doubt that many people use the Alloc procedure. A more reasonable choice is to use the alloc macro (which calls GlobalAlloc with GMEM_ZEROINIT or GMEM_FIXED), and check the returned pointer.