scsh-users
[Top] [All Lists]

Re: with-cwd not releasing memory

To: mmc@maruska.dyndns.org (Michal Maruška)
Subject: Re: with-cwd not releasing memory
From: Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
Date: Mon, 13 Oct 2003 13:32:23 +0200
Cc: Scsh Bugs <scsh-bugs@zurich.csail.mit.edu>
mmc@maruska.dyndns.org (Michal Maru¹ka) writes:

> i have this test code (note the commented version w/o  with-cwd):
> $ cat leaks.scm  
>
> #!/usr/bin/scsh \
> -e test-files -s
> !#
>
> ;; read filenames (1 per line) on stdin
> (define (test-files args)
>   (awk (read-line) (line) ()
>     (#t
>      ;(if (file-directory? line)
>      (let ((dir line))
>        ;(directory-files dir #f)       ;  this version works ok
>
>        (with-cwd dir                ;  this version doesn't free memory
>          (directory-files "." #f)
>          )))))
>
>
> Now, let's prepare a big fs tree (under  ./test):
>
> $ time (for i in 1 2 3 4 5 6 7 8 9;\
>  do  for j in 1 2 3 4 5 6 7 8 9; \
>  do for k in 1 2 3 4 5 6 7 8 9;  \
>  do for l in 1 2 3 4 5 6 7 8 9; \
>  do  mkdir -p test/$i/$j/$k/$l; \
>  done;done;done; done;  )
>
>    4,54s user 13,10s system 58% cpu 30,283 total
>
>
> now to see the problem:
> $  find  ./test  -type d | ./leaks.scm  
>
> and  watch the memory consumption (i do w/ mempeak).
>
> w/  scsh 0.6.4  i see it growing to ~ 46 MB   (on bigger tree it keeps 
> growing)
>

Yes, the c code did not free a temporary buffer. I've fixed this in
CVS.

Thank for the report!




--
Martin

<Prev in Thread] Current Thread [Next in Thread>