[racket] FFI, string, malloc/free

From: Laurent (laurent.orseau at gmail.com)
Date: Sat Jun 15 07:29:34 EDT 2013

You probably want `register-finalizer':
http://docs.racket-lang.org/foreign/foreign_pointer-funcs.html#%28def._%28%28lib._ffi/unsafe..rkt%29._register-finalizer%29%29

See also:
http://docs.racket-lang.org/foreign/Allocation_and_Finalization.html

Regarding the default behavior, I think Racket does not free automatically
what it did not allocate itself.
So the lib you're linking to either has functions to do the
allocation/deallocation, or its doc should say what you need to free
yourself.

Laurent


On Sat, Jun 15, 2013 at 12:47 PM, Клочков Роман <kalimehtar at mail.ru> wrote:

> When I describe type
>
> (_fun _string -> _string)
>
> where can I put, whether these string c-pointers should be freed after
> function call? Also, what is default behavior?
>
>
> --
> Роман Клочков
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130615/bd780ef7/attachment.html>

Posted on the users mailing list.