frame = frame.Stretch(NewWidth, NewHeight) if you do not re assign frame stretching returned image ... the image will not be changed
http://gambasdoc.org/help/comp/gb.image.imlib/image/stretch?v3 2010/5/7 Richard <[email protected]>: > Hi everybody, > > I am using Gambas 2.20.0 on Mandriva 2010.0. The desktop is LXDE and the gui > toolkit might possibly be GTK. > > I have written a button event handler to process hundreds or thousands of .png > images in a directory. The main memory available when the program starts is > around 1.8 GBytes. After processing just 744 images (in testing) this falls > to about 74 MBytes. The memory is not freed on exit from the event handler, > only when I exit from the program. > > I use only 1 Image object; a variable called "frame". I have tried declaring > this as a local in the event handler and as a class-visible variable with no > apparent change in the way memory is eaten and never disgorged. > > I do three things with my frame variable in a loop which iterates for all > frames in a directory; > > 1. I load it from an image on disc > 2. I "stretch" it to make its width smaller(!) > 3. I save the altered frame to a different directory > > Specifically the significant lines of code look like; > > frame = Image.Load(SourceImage) > frame.Stretch(NewWidth, NewHeight) > frame.Save(DestinationImage) > > Outside the loop I now do frame = NULL, but this has no effect. > > Is it possible that my code is allocating multiple "anonymous" frame objects > and not releasing them? I have read Benoit's explanation in this list of > Gambas memory management (Re: [Gambas-user] Memory Management, on > 08/09/2007 09:19). > > I turned to Gambas to program this function because my first choice, > imagemagick, would always run out of memory without processing a single > frame. The Gambas solution works, but no more work can be done without > killing the program and restarting it - not very convenient. I anticipate > that typical uses of the program will have to handle 10-30 thousand png > images at a time. > > Can anyone suggest how I find out what is so hungry for my memory, and > hopefully how to suppress its appetite? > > Richard > > ------------------------------------------------------------------------------ > > _______________________________________________ > Gambas-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ _______________________________________________ Gambas-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gambas-user
