[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Request to add *-resize! functions for contiguous mutable data struc
From: |
Vijay Marupudi |
Subject: |
Re: Request to add *-resize! functions for contiguous mutable data structures. |
Date: |
Mon, 9 Aug 2021 13:35:14 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 |
That does help with the freeing requirement, thank you Maxime!
The request for this feature, if possible, still stands, because of
ergonomic reasons, and also I want to store Scheme strings in a vector
that can be resized.
Until then, I will make do with this and the make-vector/vector-copy
strategy.
~ Vijay
On 8/9/21 1:24 PM, Maxime Devos wrote:
> Vijay Marupudi schreef op zo 08-08-2021 om 23:02 [-0500]:
>> Thank you for your responses Taylan and Maxime!
>>
>> My initial reaction to the concern about multithreaded code is similar
>> to Taylan. I'm not sure if Guile has multithreading concepts built into
>> the compiler. If so, one can only check the length again after a mutex.
>>
>> Appreciate the malloc, realloc, and free FFI solution. Ideally I
>> wouldn't have to do that, but it does work. I have to manually free it
>> though.
>
> You can avoid explicit free by using GC_MALLOC_ATOMIC and GC_REALLOC from
> bdw-gc (the C library Guile uses for garbage collection) instead of malloc
> and realloc, see <https://hboehm.info/gc/gcinterface.html>.
>
> Greetings,
> Maxme.
>