Subject: Re: How to read a binary floating-point file?
From: (Rob Warnock)
Date: Wed, 26 Jul 2006 23:25:16 -0500
Newsgroups: comp.lang.lisp
Message-ID: <>
James Bielman  <> wrote:
| You may also need to look into disabling garbage collection or
| instructing the GC not to move your array for the duration of the
| system call, for maximum safety.  I don't know about CMUCL, but in
| SBCL I would suggest the use of WITH-PINNED-OBJECTS.

    cmu> (describe 'system:without-gcing)

    WITHOUT-GCING is an external symbol in the SYSTEM package.
    Macro-function: #<Function (:MACRO SYSTEM:WITHOUT-GCING) {102BE7A9}>
    Macro arguments:
      (&rest body)
    Macro documentation:
      Executes the forms in the body without doing a garbage collection.

This should surround the call to (%FREAD (SYS:VECTOR-SAP array) ...).

Though note that in compiled code, VECTOR-SAP doesn't cons.
So since CMUCL is single-threaded (from the OS/s POV), in practice
it's safe even without the SYSTEM:WITHOUT-GCING, provided all the
other arguments to %FREAD have been precomputed as well. [This is
probably *not* the case in SBCL on platforms on which it supports
native threading.]


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607