[gambit-list] FFI Converting std::vector to scheme-vector (best practice)
Chris Mueller
ruunsmail at gmail.com
Sun Aug 18 15:56:51 EDT 2013
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
More information about the Gambit-list
mailing list