Re: calloc fails and returns NULL
k2ibegining <email@example.com> writes:
> in one of our application's module, calloc() is failing and returning
> NULL. The amount of memory that it is trying to allocate is of
> structure which is of 9292 bytes. The operating system is AIX 7.1 and
> running VIOS 22.214.171.124.
> The machine has 2+GB ram and does not seems to have an issue with lack
> of memory. The same application module is running fine on one of the
> other boxes, which has same configurations as the problematic
> box.Following is a snippet of memory from both the boxes and they are
> same !
> I'm clueless as can't really figure out why calloc() is failing even
> for 9292 bytes on this box.
I see you (I presume it was you) posted the same question on
stackoverflow.com. I'll make the same comment I made there: Show
us the code, including the call to calloc and the code that checks
And make sure that you're really passing the argument valuess you
think you are.
Also, though this probably isn't relevant to your problem, consider
whether you really need to use calloc() rather than malloc().
calloc(count, size) is equivalent to malloc(count * size) (assuming
that count*size is representable as a size_t) except that calloc()
initializes the allocated memory to zero. Do you really need that
Keith Thompson (The_Other_Keith) firstname.lastname@example.org <http://www.ghoti.net/~kst>
Will write code for food.
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
|All times are GMT. The time now is 03:40 AM.|
Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.