[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #OJR-230295]: Out of memory error



Hi Mikhail,

Sorry to take so long to reply, but I was away from my office at a meeting for 
a week.

> I was trying to create a NetCDF file using ncgen utility and received
> the following error message:
> 
> ncgen: sac.cdl line 280: out of memory
> 
> but there is more than enough memory on my machine.
> 
> On the line 280 the data begins, and cdl file is not a huge one (8.9MB).
> 
> 
> I use ncgen version 3.6.0-p1 and upper part of my cdl file (no data) is
> attached.

You need to use the "-v 2" option to ncgen when you create version 2 netCDF 
files that use 64-bit file offsets.  Each of the large variables you have 
specified require 4077588736 bytes, which is larger than the 2 GiByte limit for 
variable sizes in netCDF version 1 files.  For more information about Large 
File Support and ncgen options to support large files, see the netCDF 
Frequently Asked Questions section on Large File Support:
 
http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#Large%20File%20Support

which deals with this.  I should also note that ncdump and ncgen haven't been 
tested extensively on very large files, so you may encounter other problems.  
Also, if you use a more up-to-date version such as 3.6.1 or 3.6.2-beta, you 
would have gotten a more informative error message that might have helped to 
identify the problem:

  ncgen: NetCDF: One or more variable sizes violate format constraints

Specifying variables that are larger than 2 GiBytes can make your files less 
portable than other netCDF files, because such variables cannot be accessed on 
platforms with 32-bit size_t types, even though 64-bit off_t types are 
supported.  For example, you can't declare an array larger than 2 GiBytes on a 
32-bit system, so you could not read all the values of such a variable into a 
single memory array.

--Russ



Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: OJR-230295
Department: Support netCDF
Priority: High
Status: Closed