Guile Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile numerical work and uniform arrays



>>>>> "Maciej" == Maciej Stachowiak <mstachow@mit.edu> writes:

    Maciej> Actually, if you want to be portable you also
    Maciej> care about endianness, so maybe uniform array operations
    Maciej> are not the best basis for binary I/O.

I think binary I/O on uniform arrays had best be left out of Guile;
otherwise, we end up with a XDR implementation.  Anyway, if you are
interfacing to a library and you will want to save the results, it's
likely that the library already provides the IO routines.

    Maciej> Hmm, that solves the cases of "the array must free the
    Maciej> momory" or "the array must not free the memory", but what
    Maciej> about more complicated situations, where e.g. the array
    Maciej> memory is part of some bigger data structure and this is
    Maciej> the only reference to it, so you want to free it when the
    Maciej> array gets GC'd?

I think that indirect uve's should be only be for inter-language work.
If we want an analogy to shared strings, then that should be separate.
Since inter-language GC is iffy at best I'd suggest giving full
deallocation control to external language.  For the situation where a
library mallocs a chunk of memory and expects the caller to free it
(ie like strdup), then the interface to the library should provide a
free function.

In my work, several large chunks of memory are allocated at the
begining and they get freed by exit.  GC simply isn't an issue.   

Cheers,

Clark



Guile Home | Main Index | Thread Index