Francesc Alted wrote: > At least each open node keeps a reference to the File object. So, in > order to remove the File object you must close the nodes that reference > to them. See the File.close() for an example on how to do this. I > don't know if I have addressed your issue, but if not, please tell me.
Well, let me start with a simple problem. If I open up a file, and then don't explicitly close it, when I quit Python I get a "Closing remaining open files:" and then a list of all the files. Part of the problem is these refcounts. If the only reference was the file object, I could be at least be assured that the file objects used in a more constrained scope (inside classes or functions) would be garbage collected, but that's definitely not the case. >>> import tables, sys, gc >>> gc.set_debug(gc.DEBUG_LEAK) >>> gc.collect() 0 >>> fyle1 = tables.openFile("Foo.h5") >>> sys.getrefcount(fyle1) 6 >>> del fyle1 >>> gc.collect() 0 >>> exit() Closing remaining open files: Foo.h5... done (I've changed the name of the file to the much smaller "Foo.h5" rather than the full path.) Something is keeping that file object open, and I don't understand what. It's obviously not just a reference cycle, because it's not showing up in the garbage. It's not simply each node, as this file has 252 nodes. Printing fyle1 gives me a list of the nodes, and a new reference count of 511. Printing a file with 519 nodes, results in it have 508 references. Is the difference due to caching? So what nodes are holding the extra four references to the file? -- Anthony Foglia Princeton Consultants (609) 987-8787 x233 ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Pytables-users mailing list Pytables-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pytables-users