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]>
Hi,

I’m trying to generate a large number of images which are going to be used to create a video. My problem is that the memory footprint of the lisp image grows for each iteration, despite gp:free-image being called.

I tried to throw in a GC call in the loop, but it seems to have no effect.

Also, placing gp:with-pixmap-graphics-port inside the loop does not help.

What am I missing?

Erik


(defun allocation-test ()
  (let ((pane (capi:contain (make-instance 'capi:output-pane))))
    (capi:apply-in-pane-process pane (lambda ()
                                       (gp:with-pixmap-graphics-port (image-port pane 854 480 :background :white :clear t)
                                         (loop for n from 1 to 1000 do
                                                 
                                                 ;; 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)
                                                 
                                                 ;; Running GC here has no effect
                                                 (when (zerop (mod n 20))
                                                   (gc-generation t))

                                                 (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))))))))




_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.