static-vectors icon indicating copy to clipboard operation
static-vectors copied to clipboard

`free-static-vector` on Lispworks

Open digikar99 opened this issue 2 years ago • 1 comments

https://github.com/sionescu/static-vectors/blob/87a447a8eaef9cf4fd1c16d407a49f9adaf8adad/src/impl-lispworks.lisp#L20-L37

Can raw::free-an-object be used to free the array on lispworks? Or is there any other recommendable way to free it?

digikar99 avatar Apr 20 '23 07:04 digikar99

@digikar99 I don't know, since I don't have a Lispworks licence. Can you ask on its mailing list ?

sionescu avatar May 13 '24 21:05 sionescu

@digikar99 any update ?

sionescu avatar May 29 '24 18:05 sionescu

Sorry, I missed the previous message.

I myself am primarily an SBCL user and only have a Personal Edition of LispWorks. I don't think that lets me consult LispWorks support.

I have posted to [email protected] now.

I've also just now subscribed to the LispWorks mailing list. If no one replies on [email protected], I'll post this to the LispWorks mailing list.

digikar99 avatar May 30 '24 08:05 digikar99

Nope, we should not use raw::free-an-object. In fact, there's no appropriate function for the task. (Ref.)

Playing around, I can confirm that LispWorks can garbage collect the statically allocated vector if it goes out of scope. So, free-static-vector is fine as it is. A comment may be included about this, mentioning that LispWorks can garbage collect the vector.

Alternatively, free-static-vector could call the GC, but this seems a bit ugly.

digikar99 avatar May 31 '24 19:05 digikar99

@digikar99 If you care about portability to other implementations, you should manually free the array, or at least wrap it in a struct and add a finalizer to the struct that frees the array.

sionescu avatar May 31 '24 22:05 sionescu

Oh yes, certainly! I already have a wrapper around static-vectors for dense-arrays. But if I understand, static-vectors itself intends to be portable :). So, I can leave this portability up to it, and focus on other kinds of portability.

digikar99 avatar Jun 01 '24 03:06 digikar99