Re: memory loss with stklos Tk widgets?

From: Erick Gallesio <eg_at_kaolin.unice.fr>
Date: Sat, 06 Sep 1997 19:55:35 +0200

Mark Lynn writes:
>
> My STk programs are using more and more memory with
> execution time. I saw previous posts indicating a problem
> of this nature when using Tk images. I am not using images;
> however, every time I use make-dialog or create and then
> destroy a toplevel window with (make <Toplevel> ...)
> I seem to lose more memory. Is there some need to manually
> free objects when using the stklos objects corresponding
> to Tk widgets?

For images, it is that Tk gives no easy way to see that an image is
used by nobody. Furthermore you can define an image and use it a very
long time later in a widget. All this stuff implies that created images
must be kept in memory.

On the other side a toplevel (or any other widget should release
memory when destroyed). If this is not the case, its clearly a bug. Do
you have a simple program which exhibit this behaviour? It seems to
be correct on all the architectures I have access.

>
> Also, this problem eventually results in an "out of storage"
> message. I can postpone this message by using expand-heap to
> get more memory, but I don't understand the need to request
> more memory. Why doesn't STk dynamically allocate more
> memory? Have I missed something here?

Of course, STk allocates memory when needed. Giving the interpreter
more memory allow you to GC memory less often (In fact if after a GC
the interpreter sees that more than 75% of memory is left used, it
will itself expand memory, so doing it by hand is not really necessary).


                -- Erick
Received on Sat Sep 06 1997 - 21:07:24 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST