duplicate a image with gs

Matthias Lang <>
Fri Apr 14 10:08:54 CEST 2006


You have a loop which endlessly creates images.

It's hardly surprising that you eventually run out of memory.

What are you actually trying to do? 

Is this a homework assignment?

Matthias

--------------------


JeaDea writes:
 > My code is
 > 
 > -module(test).
 > -export([init/0]).
 > 
 > init() ->
 >     Gs = gs:start(),
 > 
 >     Win = gs:create(window, Gs,[{map,true},{title,"Drainage
 > Mine"},{width,620},{height,500}]),
 > 
 >     Cs = gs:create(canvas,CCs,[{width,620},{height,500},{bg,white}]),
 > 
 >     gs:create(image,Cs,[{coords,[{50,50}]},{load_gif,"myImage.gif"}]),
 > 
 >     loop(Cs,50,50).
 > 
 > loop(Cs,X,Y) ->
 >     gs:create(image,Cs,[{coords,[{X,Y}]},{load_gif,"myImage.gif"}),
 >     loop(Cs,X,Y+20).
 >
 > The problem is load_gif, each time a new gif is loaded in memory (the old
 > ones aren't unloaded) so that the memory never stops growing... until
 > overflow...



More information about the erlang-questions mailing list