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

Re: Memory leak in RadialDataset?

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.


  • Subject: Re: Memory leak in RadialDataset?
  • Date: Tue, 20 Mar 2007 09:35:48 -0600

Don, do you have caching on?

Anyway, make sure caching is off (NetcdfFileCache.disable()).
Yuan, can you check your code for anything obvious?

Jeff McWhirter wrote:

We seem to have a memory leak in RadialDataset when we create an RHI

Here is the scenario. I run the following loop, keeping around the references to the adapter in the tmp list so they don't get collected. The getData call reads the RHI or the sweep from the RadialDatasetSweep. The clear method in the adapter clears internal references.

       while(true) {
         CDMRadarAdapter adapter = new CDMRadarAdapter(this, file);
         tmp.add(adapter);
         adapter.getData(dataChoice, subset,
                           requestProperties);
         adapter.clear();
       }

If I run this and do not clear the reference to the RadialDatasetSweep that it holds then I get a big memory leak. If I clear the reference then no leak. So, this tells me that somewhere in the RadialDatasetSweep world there a retained reference to data. Is there any caching going on here on purpose? or is there a stray pointer
to some data?

-Jeff