On Wed, Nov 13, 2013 at 04:19:31PM -0500, Ramsey Hazbun wrote: > The MAJOR issue I'm having, and would appreciate some help with: > - This script can't process more than about 50-100 images without crashing > Gwyddion. I haven't nailed down the exact number. Based on the GTK errors > I'm getting this is almost definitely a memory management issue (unable to > allocate memory). When I added the FFT filters which declare a couple > extra DataFields and DataLines, the problem got worse. Yeti has warned > people about trying to do what I'm doing in the pygwy console, and I'm > guessing it's because of this. I spent a long time trying to figure out > how to release memory (ie: garbage collection), but Python is supposed to > do this automatically, and doing explicitly doesn't seem to work. It > occurs to me that perhaps Gwyddion needs to release the memory and there's > a function I need to call, but I can't figure out what that is. Removing > from the data browser is not sufficient.
Well, apparently the Python file-load functions cause reference leaks which means the data are never released, even though no longer accessible from Python. In general, C functions which create new data objects (and are not just constructors) seem to need manualy written wrappers to avoid leaks because codegen doesn't recognise this transfer of ownership automatically (and can't be blamed much as it really can't know). The attached patch may fix the problem for gwy_file_load() and gwy_app_file_load(). I'm not really sure it is correct though, i.e. if it is correct to get rid of one reference immediately. So I havent' committed it. But it seems to work for me, please test. To be fair, I have only an approximate idea how the python codegen wrapping works... Regards, Yeti ------------------------------------------------------------------------------ DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk _______________________________________________ Gwyddion-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gwyddion-users
