Calloc fails and returns NULL

in one of our application modules, calloc () does not work and returns NULL. The amount of memory that he is trying to allocate has a structure that is 9292 bytes. The operating system is AIX 7.1 and works with VIOS 2.2.1.3.

The device has 2 + GB of RAM and does not seem to have a problem with a lack of memory. The same application module works fine in one of the other blocks, which has the same configurations as the problem block. A sequence is a piece of memory from both boxes, and they are the same!

WORKBOX:

  RLIMIT_AS (infinite) (infinite)
 RLIMIT_CORE 1073741312 (infinite)
 RLIMIT_CPU (infinite) (infinite)
 RLIMIT_DATA 134217728 (infinite)
 RLIMIT_FSIZE (infinite) (infinite)
 RLIMIT_NOFILE 2000 (infinite)
 RLIMIT_RSS 33554432 (infinite)
 RLIMIT_STACK 33554432 2147483646 

PROBLEM BOX:

  RLIMIT_AS (infinite) (infinite)
 RLIMIT_CORE 1073741312 (infinite)
 RLIMIT_CPU (infinite) (infinite)
 RLIMIT_DATA 134217728 (infinite)
 RLIMIT_FSIZE (infinite) (infinite)
 RLIMIT_NOFILE 2000 (infinite)
 RLIMIT_RSS 33554432 (infinite)
 RLIMIT_STACK 33554432 2147483646 

I don’t know how I can’t understand why calloc () fails even for 9292 bytes in this field.

thanks

+6
source share
1 answer

Try calloc (1, sizeof (ifp_handle_t)); instead of calloc (sizeof (ifp_handle_t), 1); I may be wrong, but it looks like you have inverted the parameters.

+1
source

All Articles