Re: NCL Error: fatal:NclMalloc Failed:[errno=12], Segmentation Fault

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Wed, 14 Jan 2009 10:23:33 -0700 (MST)

Karsten,

Without being able to run your script, and knowing what size of loops
and variables you have, I can only guess at what might be the problem.

It is possible that your loops and variables are large enough that
even with all the deleting, you are still running out of memory
somewhere.

You appear to be doing the right thing with regard to deleting
variables in the loop.

However, it's important to keep things out of a loop if you can. For
example, if you know a variable is always going to be the same size
every time in the loop, then it's better to create it once outside the
loop. This way, the "new" and "delete" activity is not happening for
every loop iteration.

I did notice that you have a variable "x3d" inside of "create3d", and
then it is being used as the return variable name from "create3d". You
might want to give this a different name so there's no
conflict. (Scoping rules allow you to refer to global variables inside
a function, which might cause problems if you reference them
incorrectly.) I don't think this will fix your malloc problem,
however.

Can you email me offline and let me know if it might be possible
for me to debug your script somewhere?

--Mary

On Wed, 14 Jan 2009, Karsten Peters wrote:

> Hello folks,
>
> this will be my first contribution to ncl-talk, so please don't hesitate
> to tell me what I did not include in my message ;-).
>
> I am processing satellite level2 data in order to put it on a normal
> global grid and I am using code that was provided to me by Dennis. The
> satellite data normally has array sizes of 4224*191*float and the output
> array size is 721*1441*float. After many iterations, the error message:
>
> fatal:NclMalloc Failed:[errno=12]
> Segmentation fault
>
> appears (out of the blue for me ;-) ). From reading other ncl-talk
> messages (this error seems to happen quite often), it is pretty sure
> that this is a memory issue. I am pretty much deleting all variables
> created for every iteration in order for them to not grow over the 2GB
> limit. I will attach my code to this message (the principal code starts
> at approx. line 107).
>
> I hope you guys can help me handle these memory issues ! And by the way,
> is there some other way to handle these NCL memory problems besides
> deleting variables all the time and configurating the memory capacities
> of the machine NCL is running on ?
>
> Regards and many thanks,
>
> Karsten
>
> --
> Karsten Peters
>
> Meteorological Institute
> University of Hamburg
>
> c/o Max-Planck Institute for Meteorology
> Bundesstrasse 53
> D-20146 Hamburg
>
> ------------------------------------------------------------------
>
> Tel.: ++49 (0)40 41173 147
> Fax.: ++49 (0)40 41173 298
>
> Email: karsten.peters_at_zmaw.de
> URL: http://www.mpimet.mpg.de/~peters.karsten
>
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 14 2009 - 10:23:33 MST

This archive was generated by hypermail 2.2.0 : Fri Jan 16 2009 - 14:05:56 MST