duplicate a image with gs

Romain Lenglet rlenglet@REDACTED
Fri Apr 14 11:06:03 CEST 2006


> 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...

Have you ever thought about using gs:destroy?
gs is a binding to Tk, which requires to explicitly destroy 
objects. The gs graphics server does automatic garbage 
collection of those non-Erlang objects, but it is done only when 
the process "owning" (i.e. created) the objects terminates.
Cf. section 2.4 of the GS User's Guide.
If you want to destroy objects before the "owning" process 
terminates, use gs:destroy/1.

Id = gs:create(image, ...),
gs:destroy(Id)

-- 
Romain LENGLET



More information about the erlang-questions mailing list