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@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@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list