From: Mertens Marc
Subject: ALIEN objects and GC in CMUCL
Date: 
Message-ID: <32A1C224.3213E547@akam.be>
Hello,

     I have defined an alien function in CMUCL by the following code :


(def-alien-routine "sendcommand" c-string  (str c-string) (i int
:out))   


and have the following problem with it. The CMUCL is dooing an abnormal
amount of garbage collection when calling this function (aproximately
every 40 call's). I'm using all the default settings and the CMUCL 
implementation for LINUX. 
Can someone give me suggestions on how to avoid this exess in gc.


Thanks a lot in advance.

Marc Mertens
·········@akam.be
From: Martin Cracauer
Subject: Re: ALIEN objects and GC in CMUCL
Date: 
Message-ID: <1996Dec3.123541.19561@wavehh.hanse.de>
Mertens Marc <·········@akam.be> writes:

>     I have defined an alien function in CMUCL by the following code :

>(def-alien-routine "sendcommand" c-string  (str c-string) (i int
>:out))   

>and have the following problem with it. The CMUCL is dooing an abnormal
>amount of garbage collection when calling this function (aproximately
>every 40 call's). I'm using all the default settings and the CMUCL 
>implementation for LINUX. 
>Can someone give me suggestions on how to avoid this exess in gc.

In am looking somewhat deeper into CMUCL's alien definitions, but I
didn't came far enough to have the real answer for you.

I made the following observations:

1) Returning a C-string is very costly, much more than passing
one. Maybe it's an option for you to change your C routine so that it
fills a predefined array of chars passed preallocated from Lisp?

If you don't need to use the string from Lisp at all, don't convert
it. 

2) It is very important to compile the whole thing proberly. I made my
first tests using partial compilation of function and consing became a
real pain. I put the alien definitions and the Lisp functions that use
them into a seperate file and compiled it with compile-file. 1/10th of
the bytes were consed then.

It would be good to know how much data is consend exactly in the loop
where the alien function is called. CMUCL's (time ...) gives this
information.

There is now a cmucl-help mailing list at my site. You'll have a
better change to get more useful info there than in usenet. See 
http://www.cons.org/cmucl/

Let me know if you need more info. I'd appreciate it if you would drop
me a note how things turned out, positive or negative.

Martin
--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
···············@wavehh.hanse.de http://cracauer.cons.org  Fax.: +4940 5228536
"As far as I'm concerned,  if something is so complicated that you can't ex-
 plain it in 10 seconds, then it's probably not worth knowing anyway"- Calvin