Re: Allocation/gc for pixmaps
"Erik Ronström (as erik dot ronstrom at doremir dot com)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Thanks for your answer! > It is a known issue, at least in Mac OS Is it an issue with LispWorks or a problem with the underlying OS functions? My guess is that the objects actually *are* garbage collected, but the memory isn’t returned to the OS until the next message loop cycle. Could that be the case? > My naive "solution" would be the following. Well, that could work for me I suppose… but I wonder, is the sleep actually necessary? The process of generating so many images are already pretty time consuming so I would rather not add any more time to it unless absolutely necessary. (It also feels a bit sketchy to sleep a random amount of time – what if it is too short and memory is still not released?) Erik > 18 sep. 2025 kl. 09:48 skrev Krupka Michal <[email protected]>: > > It is a known issue, at least in Mac OS. My naive "solution" would be the following. It seems to work in my case when LW is in foreground. > > (defun allocation-test () > (let ((pane (capi:contain (make-instance 'capi:output-pane)))) > (loop for n from 1 to 1000 do > (capi:apply-in-pane-process pane (lambda () > (gp:with-pixmap-graphics-port (image-port pane 854 480 :background :white :clear t) > > ;; Clear the pixmap and draw something > (gp:draw-rectangle image-port 0 0 854 480 :foreground :white :filled t) > (gp:draw-string image-port (format nil "Frame ~a" n) 50 50) > > (let ((image (gp:make-image-from-port image-port))) > > ;; ... export the image using e.g. gp:externalize-and-write-image ... > > (gp:free-image image-port image))))) > when t ;; or some time has passed > (sleep 0.5 ;; or some other interval > )))) > > Michal _______________________________________________ Lisp Hug - the mailing list for LispWorks users [email protected] http://www.lispworks.com/support/lisp-hug.html