unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: <tomas@tuxteam.de>
To: guile-devel@gnu.org
Subject: Re: Request to add *-resize! functions for contiguous mutable data structures.
Date: Sat, 7 Aug 2021 23:19:57 +0200	[thread overview]
Message-ID: <20210807211957.GA730@tuxteam.de> (raw)
In-Reply-To: <5de0d09e-263a-20e3-a0d0-7868593db585@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2021-08-07 21:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-06 14:33 Request to add *-resize! functions for contiguous mutable data structures Vijay Marupudi
2021-08-07 10:31 ` Taylan Kammer
2021-08-07 21:19   ` tomas [this message]
2021-08-08 12:17     ` Taylan Kammer
2021-08-07 11:09 ` Maxime Devos
2021-08-07 17:46   ` Taylan Kammer
2021-08-09  4:02     ` Vijay Marupudi
2021-08-09 18:24       ` Maxime Devos
2021-08-09 18:35         ` Vijay Marupudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210807211957.GA730@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=guile-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).