chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] do byte-vectors move arround ?


From: felix winkelmann
Subject: Re: [Chicken-users] do byte-vectors move arround ?
Date: Mon, 9 Oct 2006 09:54:27 +0200

On 10/8/06, John Janecek <address@hidden> wrote:
(define bv (string->byte-vector "some sort of string"))
I then have to pass bv to a C function

The C function just reads the data.
But it requires that the data does not move

Does byte-vector payload move ?
or do I need to use static-byte-vector ?

Yes, when a garbage collection occurs, the string contents
may move to a different address. GC's only occur
during callbacks to Scheme, or when you store (Scheme) strings
in C globals and access them during separate invocations of C
code.

A static byte vector would indeed be a solution, the contents do not
move, but you have to release them manually, of course.


cheers,
felix


--
http://galinha.ucpel.tche.br:8081/blog/blog.ssp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]