[cl-typesetting-devel] memory not getting released

David J Cooper Jr david.cooper at genworks.com
Sat Apr 3 06:14:34 UTC 2004


Hello,
 
 I'm not sure why I didn't notice this before, but it looks like
 compile-text (or something) is allocating memory and keeping some
 kind of pointer to it alive so that even a global GC will not free
 it. Before I dive in and try tracking it down i tought i would ask if
 i'm missing something obvious...
 
 This is in Allegro CL, so maybe it is some issue specific to Allegro.

 Anyway here is a sample little function in the TT package:

   (defun pdf-text (&key (columns 5) (rows 10))
     (pdf:with-document ()
       (pdf:with-page (:bounds (make-array 4 :initial-contents (list 0 0 800 7000)))
	 (let ((content (compile-text ()
				      (paragraph () 
						 (dotimes (row rows)
						   (with-style () :eol)
						   (dotimes (column columns)
						     (put-string "babababababababa")))))))
	   (draw-block content 20 6900 545 6700 0)))
       (pdf:write-document #p"/tmp/try.pdf")))

 and below is a trace of running it (in the room commands, i've edited
 the output to show just total oldspace). Note that before running
 pdf-text 100 times, there is 15604616 of total used other bytes in
 oldspace. After running it and doing a couple of global GC's, there
 is 27760472 used. So i'm trying to figure out what is taking up the
 extra 12,155,856 bytes here... (as well as an extra 230,799 cons
 cells).

Trace:
==================================================================
TT(4): (room)
area area  address(bytes)        cons         other bytes
  #  type                   8 bytes each
                             (free:used)      (free:used)
     OTot(Old Areas)           859:395532     18464:15604616

TT(5): (dotimes (n 100) (pdf-text))
9310456 bytes have been tenured, next gc will be global.
See the documentation for variable *GLOBAL-GC-BEHAVIOR* for more information.
8640608 bytes have been tenured, next gc will be global.
See the documentation for variable *GLOBAL-GC-BEHAVIOR* for more information.
NIL
TT(6): (room)
area area  address(bytes)        cons         other bytes
  #  type                   8 bytes each
                             (free:used)      (free:used)
     OTot(Old Areas)           201:621389    837440:27384152

TT(7): (excl:gc t)
TT(8): (excl:gc t)
TT(9): (room)
area area  address(bytes)        cons         other bytes
  #  type                   8 bytes each
                             (free:used)      (free:used)
     OTot(Old Areas)           354:626331    420160:27760472
==================================================================
   
For more complicated documents with tables etc the problem seems to
grow accordingly...

Thanks to everyone for all the great additions lately, and again sorry
if i'm missing something obvious here...

 -dave
 David J Cooper Jr, Genworks International
 david.cooper at genworks.com
 +1 248-737-8835(o), +1 248-330-2979(c)





More information about the cl-typesetting-devel mailing list