Re: What are the various conditions that could cause a malloc error?

From: Dave Allured <dave.allured_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 27 2010 - 19:21:33 MST

Bridget,

It is very helpful in cases like this to see the actual NCL
statement where the error occurred, as well as the output from
printVarSummary for each variable in that statement.

NCL being a dynamic language, there are many things that can cause a
malloc error. The general cause that I have seen most frequently
is, of course, the use of very large data arrays.

It is easy to use up memory by inadvertently making copies of large
arrays. Aside from what can be done in your own user code, a number
of NCL library functions make hidden copies of part or all of their
input arrays to carry out the requested function. This is why
malloc errors frequently occur inside NCL library functions rather
than in user code where the huge array originated. However, NCL
functions usually release their allocated memory when they return to
the calling program.

Dave Allured
CU/CIRES Climate Diagnostics Center (CDC)
http://cires.colorado.edu/science/centers/cdc/
NOAA/ESRL/PSD, Climate Analysis Branch (CAB)
http://www.esrl.noaa.gov/psd/psd1/

Bridget Thrasher wrote:
> I am unable to figure out why I am getting the malloc error below. I'm
> running 5.1.1 on Mac OSX 10.5.8, there are over 6GB of memory available
> when the process starts, and
> over 3GB available when it fails. I'm getting an additional 8GB of
> memory soon, but I'm not confident that it will solve my problem since
> in theory it seems the process should run just fine on the 8GB that are
> already in the box. What else leads to a malloc error?
>
> ncl(25887) malloc: *** mmap(size=16777216) failed (error code=12)
> *** error: can't allocate region
> *** set a breakpoint in malloc_error_break to debug
> fatal:NclMalloc Failed:[errno=12]
>
> -Bridget
>
> --
> Bridget Thrasher, PhD
> Postdoctoral Researcher
> Climate Central
> www.climatecentral.org <http://www.climatecentral.org>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 27 19:21:41 2010

This archive was generated by hypermail 2.1.8 : Mon Feb 01 2010 - 08:05:34 MST