[gambit-list] FFI Converting std::vector to scheme-vector (best practice)

Mikael mikael.rcv at gmail.com
Sat Aug 17 16:59:49 EDT 2013


On struct it would make sense, it was indeed only pointered types I had on
my mind. Allocate a billion, see for yourself and tell here?


2013/8/17 Chris Mueller <ruunsmail at gmail.com>

>  Am 16.08.2013 09:54, schrieb Mikael:
>
>
>  Remember that for c-define-type :s that do not have a release procedure
> specified, there is *no* deallocation (such as free() etc.) invoked at
> their scheme-world GC.
>
>
> I've read in the documentation for the default release function (pointer
> ..) and (nonnull-pointer ...) types are not performing any deallocation
> like you mentioned.
>
> I'm a little bit curious about (struct ..) type-definitions because due to
> the documentation it has probably a more useful default behaviour for
> releasing.
>
> Can i assume if i allocate and use a (struct ...) type that the GC
> management system will handle this reference properly? (in contrast to
> pointers)
>
> This would save me a lot of specific cleanup code for all predefined types
> if gambit's system is performing delete calls automatically for structs.
>
> e.g.
>
> (c-define-type std::string (struct "std::string"))
> (define string-new (c-lambda (nonnull-char-string) std::string
> "___result_voidstar = new std::string(___arg1);"))
>
>
> Only for clarification for myself i don't create memory leaks.
>
> Thanks,
> Chris
>
>
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list at iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://webmail.iro.umontreal.ca/pipermail/gambit-list/attachments/20130817/a63c7dae/attachment.html 


More information about the Gambit-list mailing list