Does AllocMem() give error messages?

#1
Should I

Code:
if ( (pInfo = (PIP_ADAPTER_ADDRESSES) AllocMem(dwInfoSize)) == NULL )
{
    error(ERROR_NOT_ENOUGH_MEMORY, NULL);
    return 0;
}
or can I rely on AllocMem() to generate an error message?
 

rconn

Administrator
Staff member
May 14, 2008
10,638
97
#2
> Code:
> ---------
> if ( (pInfo = (PIP_ADAPTER_ADDRESSES) AllocMem(dwInfoSize)) == NULL )
> {
> error(ERROR_NOT_ENOUGH_MEMORY, NULL);
> return 0;
> }
> ---------
> or can I rely on AllocMem() to generate an error message?
AllocMem does not return error messages, just a null if it can't allocate
memory. (If it can't, your system is probably toast anyway, as all of the
virtual memory will have been eaten.)

Rex