Use this, it always work. Alloc only able to allocating a few megabytes memory
mAlloc proc nSize:dword
add nSize,4
invoke GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,nSize
.if eax==0
invoke PERR
invoke MessageBox,NULL,addr mem_error,NULL,MB_OK
.endif
ret
mAlloc endp