January 12, 2006 Can't fix segmentation fault | ||||
---|---|---|---|---|
| ||||
Here is a code below that generate directory tree. When I am trying to run it on big folders, it causes 'segmentation fault' error. May be anyone knows some possible reasons for this? # Code listing private import std.file; struct FileDesc { char[] path; ulong size; } public FileDesc[] list() { FileDesc[] res = null; FileDesc file; void scandir(char[] path) { foreach(char[] name; listdir(basepath ~ path)) { file.path = path ~ name; if (isdir(basepath ~ file.path)) { file.size = 0; res ~= file; scandir(file.path ~ '/'); } else { file.size = getSize(basepath ~ file.path); res ~= file; } } } scandir(""); return res; } |
January 12, 2006 Re: Can't fix segmentation fault | ||||
---|---|---|---|---|
| ||||
Posted in reply to KUV | KUV wrote:
> Here is a code below that generate directory tree. When I am trying to run it on
> big folders, it causes 'segmentation fault' error.
> May be anyone knows some possible reasons for this?
Q: What did the debugger say ?
(compile with -g, run with gdb)
--anders
|
Copyright © 1999-2021 by the D Language Foundation