[racket] make-sized-byte-string and GC
Is making bytestring from pointer adds the pointer to GC?
> (define x (malloc 'raw 10))
> x
#<cpointer>
> (define b (make-sized-byte-string x 10))
> (cpointer-gcable? b)
#t
> (cpointer-gcable? x)
#f
> (cast x _pointer _int32)
173726656
> (cast b _pointer _int32)
173726656
So b and x points to the same block of 10 bytes, but value of b is GCable and value of x is not.
I assume, that when b will be changed, then the bytestring will be collected and accessing x will give segfault. Am I right?
--
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140125/07392043/attachment.html>