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

Chris Mueller ruunsmail at gmail.com
Sat Aug 17 12:44:05 EDT 2013


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://webmail.iro.umontreal.ca/pipermail/gambit-list/attachments/20130817/41474aa5/attachment.html 


More information about the Gambit-list mailing list