[Top][All Lists]

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

ftw/nftw is limited by stack size

From: Jim Meyering
Subject: ftw/nftw is limited by stack size
Date: Fri, 17 Jan 2003 11:41:50 +0100

ftw/nftw currently uses explicit recursion, and as such is limited
by the size of the user's stack.

For example, those functions may not be used to traverse a hierarchy
of depth 40000;  a simple traversal-no-op program blows the stack
and gets a segfault on my system:

  $ perl -e '$i=0; do {mkdir "z",0700; chdir "z"} until (++$i == 40000)')
  $ ./a.out z
  Segmentation fault
  [Exit 139 (SIGSEGV)]

What do you think about rewriting it to use space on the heap
rather than on the stack?

Attachment: pgpf0ngC7KFrh.pgp
Description: PGP signature

reply via email to

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