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

Mikael mikael.rcv at gmail.com
Mon Aug 19 00:13:31 EDT 2013


std::string requires delete to be used for proper deallocation and free()
might just partially deallocate it, no? - what about trying with some more
ordinary struct like tm ?


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

> On 17.08.2013 22:59, Mikael wrote:
> > 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?
>
> I've checked this with the following example.
>
> (define (alloc-string n)
>    (let loop ((i 0))
>       (if (< i n)
>         (let ((a (std::string "test")))
>             (loop (+ i 1)))
>          (write "FIN")))))
>
> When using (struct std::string ...) without a release function, memory
> grow's rapidly (checked this in htop) until it heap overflows.
>
> With a given release function memory assumptions is constantly small.
>
> Seems there is currently no difference in the deallocation behaviour
> between structs and pointer types.
>
> Too bad :/
>
> 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://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20130819/7ab22e17/attachment.htm>


More information about the Gambit-list mailing list