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 12:14:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)

() Hengqing Hu <address@hidden>
() Tue, 22 Jan 2013 16:51:04 +0800

   Can somebody help to look into the code and tell me what's wrong?

I don't know if this is the only problem, but certainly it contributes.
The proc ‘enumerate-interval’ consumes stack unnnecessarily.

 guile> (enumerate-interval 3 500)
 ERROR: Stack overflow
 ABORT: (stack-overflow)

Here is another implementation that doesn't have that problem.

 (define (enumerate-interval low high)
   (map (lambda (i)
          (+ i low))
        (iota (- high low -1))))

-- 
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: pgpIQH07y0Sbv.pgp
Description: PGP signature


reply via email to

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