On Tue, Jul 02, 2019 at 06:24:32PM -0500, Robert R Chrostowski wrote:
> in the process i'm fairly certain I've found a memory leak in the gwy file
> saving function for .txt files
> 
> The example script:
> 
> import os
> import sys
> path = os.path.join("C:\Users","user","Desktop","test")
> sys.path.append(path)
> 
> for repeat in xrange(0,1000):
> C = gwy.gwy_file_load(os.path.join(path,"test.ibw"), gwy.RUN_NONINTERACTIVE)
> gwy.gwy_app_data_browser_add(C)
> gwy.gwy_app_data_browser_select_data_field(C, 0)
> gwy.gwy_file_save(C,os.path.join(path,"test"+str(repeat)
> +".txt"),gwy.RUN_NONINTERACTIVE)
> gwy.gwy_app_data_browser_remove(C)
> 
> will rapidly consume memory and crash

I had some trouble reproducing it – because it only occurs in MS
Windows, where we need wrappers for some libc functions and
gwy_fprintf() was leaking the printed string (which is indeed a massive
leak).

It should be fixed in r22186, so also tomorrow's or later development
snapshot.

> Is there an alternative format I should use for output as a [2x2] matrix of
> height values?

I do not understand the ‘2×2’ part.  Are your images just 2×2, or you
want to create some block matrix structure, or...?

Anyway, you can do

    data = datafield.get_data()

to get image data as a flat list and then write it to a file in any
shape or form you wish.

Regards,

Yeti



_______________________________________________
Gwyddion-users mailing list
Gwyddion-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gwyddion-users

Reply via email to