chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] binary data


From: john
Subject: Re: [Chicken-users] binary data
Date: Tue, 12 Sep 2006 22:27:24 +0100

Ok thanks, I understand what route to take now.

Cheers,

John.

On 12/09/06, Kon Lovett <address@hidden> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sep 12, 2006, at 12:01 PM, john wrote:

> Thanks guys for the responses.
>
> Another related question...
>
> If I allocate memory in Chicken using a byte-vector and pass this over
> to C, what happens if the C code consumes the memory and does a
> realloc on its pointer?

Probably a SEGV at some point, after who knows how much damage is done.

realloc might free, then malloc, when it cannot grow the existing
memory allocation in place. This would change the assumptions Chicken
makes about managed objects in its' heap; i.e. existing references to
this byte-vector would point to free'ed memory!

I think Felix suggested the use of unmanaged memory for this kind of
thing.

> I am guessing Chicken (byte-vector-length)
> would just not know about any extra bytes created but I could still
> call file-write on the byte-vector with the new byte size if I obtain
> it from C?

Much worse then "just not know."

>
> Cheers,
>
> John.
>
>
> _______________________________________________
> Chicken-users mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/chicken-users

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)

iEYEARECAAYFAkUHC+IACgkQJJNoeGe+5O4aGACfYpdKiantOmeF7Y52Ogk1UMJE
hzgAnRhCl6BrdoQlZ8LGoQ51MxyQPsFx
=sUns
-----END PGP SIGNATURE-----





reply via email to

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