[Openmcl-devel] Checking ivector space use

Jon S. Anthony j-anthony at comcast.net
Mon Mar 15 18:00:47 UTC 2010


On Mon, 2010-03-15 at 13:02 -0400, Gail Zacharias wrote:
> At 3/15/2010 12:10 PM, Jon S. Anthony wrote:
> >On Mon, 2010-03-15 at 11:40 -0400, Gail Zacharias wrote:
> > > At 3/15/2010 11:13 AM, Jon S. Anthony wrote:
> > > >Hi,
> > > >
> > > >Is there any "standard" way to check up on ivector (which I suppose
> > > >really means foreign memory) use?  I tried room, heap-utilization, and
> > > >time, and none report anything about this.  Since the GC pays no
> > > >attention to this stuff, that makes some sense.  But maybe there's
> > > >something I'm missing.
> > >
> > > Terminology problem here - ivectors are things like strings and bit
> > > vectors.  You must mean something else...
> >
> >Well, could be.  I specifically I am looking at ivectors, as made by
> >make-heap-ivector.  The documentation for that says that these are
> >allocated in "foreign memory" and that the GC pays no attention to these
> >objects.
> 
> Ah, ok.  The "foreign memory" is just the malloc heap.  You can get 
> info about the malloc heap with ccl::show-malloc-info:

Cool!  That just works:

$ ccl
Welcome to Clozure Common Lisp Version 1.5-dev-r13464M-trunk
(LinuxX8632)!
? (defun make-page-vector (size)
  #+ccl
  (multiple-value-bind (vector pointer)
      (ccl:make-heap-ivector size '(unsigned-byte 8))
    (list pointer vector)))
MAKE-PAGE-VECTOR
? (setf *print-length* 1000)
(setf *print-array* nil)1000
? 1
NIL
? 1
? (ccl::show-malloc-info)
 arena size: 135168/#x21000
 number of unused chunks = 2
 number of mmap'ed chunks = 0
 total size of mmap'ed chunks = 0/#x0
 total size of malloc'ed chunks = 87288/#x154F8
 total size of free chunks = 47880/#xBB08
 size of releaseable chunk = 42776/#xA718
NIL
? (let ((mem))
  (dotimes (i 20)
    (push (make-page-vector (* 8 (* 1024 1024))) mem))
  mem)
((#<A Foreign Pointer #xB5F08014> #<VECTOR 8388608 type (UNSIGNED-BYTE
8), simple>) ...
...
? (ccl::show-malloc-info)
 arena size: 135168/#x21000
 number of unused chunks = 3
 number of mmap'ed chunks = 20
 total size of mmap'ed chunks = 167854080/#xA014000
 total size of malloc'ed chunks = 87288/#x154F8
 total size of free chunks = 47880/#xBB08
 size of releaseable chunk = 42776/#xA718
NIL
? 

Thanks!

/Jon





More information about the Openmcl-devel mailing list