Allocates memory and sets memory to zero
#include <nwdp_lib.h>
N_EXTERN_LIBRARY (NWDPInitCode) NWDPLibCalloc (
NWDPAccessorRef accessorRef,
pnptr resultMemPtr,
nint numElements,
nint szMem);
(IN) Specifies the NWDPAccessorData structure whose fields are accessed by using the provided error macros.
(OUT) Points to a pointer which will receive the newly allocated memory's address.
(IN) Specifies a number of array elements.
(IN) Specifies the amount of memory needed for each array element.
0x00000000 |
N_SUCCESS |
0x030A0001 |
NWDP_EC_NO_MEMORY |
0x030A0009 |
NWDP_EC_ARTIFICIAL_MEM_LIMIT |
0xFFFFFFFE |
NWDP_RC_INVALID_ACCESSOR |
0xFFFFFFFF |
N_FAILURE |
NWDPLibCalloc is not recommended except for applications which must use this library.
NWDPLibCalloc can block if the server has to wait for allocation.
Any memory allocated by NWDPLibCalloc is automatically freed when NWDPLibTerm is called.
The size of memory allocated is (numElement*szMem).
NWDPLibCalloc is equivalent to calloc from the C run-time library except for error handling.
The errors NWDP_EC_NO_MEMORY and NWDP_EC_ARTIFICIAL_MEM_LIMIT both return the following information:
The otherError field of the accessorRef will contain the size of the request made of the system ( szMem), and the otherError2 field of the accessorRef will contain the current memory allocation total made through NWDPLibxxxx entry points.