[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Request to add *-resize! functions for contiguous mutable data struc
From: |
tomas |
Subject: |
Re: Request to add *-resize! functions for contiguous mutable data structures. |
Date: |
Sat, 7 Aug 2021 23:19:57 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Sat, Aug 07, 2021 at 12:31:09PM +0200, Taylan Kammer wrote:
> On 06.08.2021 16:33, Vijay Marupudi wrote:
> > Hello!
> >
> > I was curious if Guile would be willing to provide a series of
> > new procedures for resizing contiguous memory regions.
[...]
> Sounds like a good idea to me. I didn't know realloc() was a
> thing in C (I don't write much C) and I suppose it's not possible
> to implement equivalent functionality with equivalent performance
> purely in Scheme.
>
> I'm on vacation for the next three weeks and will try to write a
> patch to implement this if no one beats me to it. :-)
>
> One consideration is how this should behave in the case of
> bytevectors that were created from an FFI pointer [...]
Hm. I don't understand. Realloc /may/ return a different pointer
from the one it receives, for example if there isn't enough
room "beyond" the currently allocated. It will copy over the
contents, but if someone is holding a pointer to the old area
(as I understand you, this will be the case with an FFI pointer),
this isn't going to end well...
And then there is the constraint that the (original) pointer
passed to realloc /must/ be one returned by one of the malloc
family (how would the allocator know the original size otherwise?)
Cheers
- t
signature.asc
Description: Digital signature