Subject: | 64-bit memory allocation problems (segmentation fault) |
When using the PDL::NetCDF function 'get' in a 64-bit environment the
program crashes with a segmentation fault. Some functions work such as
'getvariablenames', but the 'get' causes problems. If you include the
PDL package there is some modest error catching and a message. I have
created an example crash using a one-line perl command from the command
line:
For testing I downloaded a netcdf file fron UCAR:
http://www.unidata.ucar.edu/software/netcdf/examples/ECMWF_ERA-40_subset.nc
System: GNU/Linux x86_64 runing CentOS 4.5
perl version 5.8.8,
PDL version 2.4.3
PDL::NetCDF version 0.93
Show quoted text
> perl -e 'use PDL; use PDL::Core; use PDL::NiceSlice; use PDL::NetCDF;
use PDL::Ops; $localfile = "ECMWF_ERA-40_subset.nc"; $ncdata =
PDL::NetCDF->new($localfile, {MODE => PDL::NetCDF->O_RDONLY}); $varnames
= $ncdata->getvariablenames(); print "\n@$varnames \n\n\n";$varname =
"msl"; $data_nwp = $ncdata->get($varname); $val = $data_nwp ->
slice("12:12,2:2");$ts = $val->clump(3); print "$ts\n";'
longitude latitude time tcw tcwv lsp cp msl blh tcc p10u p10v p2t p2d e
lcc mcc hcc tco3 tp
**ERROR: in routine alloca() there is a
stack overflow: thread 0, max 10228KB, used 0KB, request 24B
Running the same command on an i386 machine also running CentOS works fine:
Show quoted text> perl -e 'use PDL; use PDL::Core;use PDL::NiceSlice; use PDL::NetCDF;
use PDL::Ops; $localfile = "ECMWF_ERA-40_subset.nc"; $ncdata =
PDL::NetCDF->new($localfile, {MODE => PDL::NetCDF->O_RDONLY}); $varnames
= $ncdata->getvariablenames(); print "\n@$varnames \n\n\n";$varname =
"msl"; $data_nwp = $ncdata->get($varname); $val = $data_nwp ->
slice("12:12,2:2");$ts = $val->clump(3); print "$ts\n";'
longitude latitude time tcw tcwv lsp cp msl blh tcc p10u p10v p2t p2d e
lcc mcc hcc tco3 tp
[3.6984438e+08 3.6983769e+08 3.6984451e+08 3.6983769e+08 3.6984494e+08
3.6983769e+08 .....etc.]
The command also works on a Mac running OS10.5.5.