guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to identify a potential memory leak in guile programs?


From: Thien-Thi Nguyen
Subject: Re: How to identify a potential memory leak in guile programs?
Date: Tue, 22 Jan 2013 17:35:53 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

() Hengqing Hu <address@hidden>
() Tue, 22 Jan 2013 23:09:00 +0800

   After make it iterative, the fault disappears.
   Many thanks to the help!

    (define (enumerate-interval low high)
   -  (if (> low high)
   -    nil
   -    (cons low (enumerate-interval (+ low 1) high))))
   +  (let loop ((i high)
   +             (interval nil))
   +    (if (< i low)
   +      interval
   +      (loop (- i 1) (cons i interval)))))

Cool.  I see that the new implementation is not only iterative, but also
non-destructive (like the old) and tail-recursive (unlike the old).

-- 
Thien-Thi Nguyen ..................................... GPG key: 4C807502
.                  NB: ttn at glug dot org is not me                   .
.                 (and has not been since 2007 or so)                  .
.                        ACCEPT NO SUBSTITUTES                         .
........... please send technical questions to mailing lists ...........

Attachment: pgpw0Pz7U_tco.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]