Does anybody have an idea why does the following code use an absurd 4.75 GB of memory?
Is there any better way to loop for all files in the filesystem? (I'm trying to find the largest files on the drive)
let filemanager:FileManager = FileManager()
let root = "/"
let files = filemanager.enumerator(atPath: root)
while let element = files?.nextObject() {
// do nothing
}
Note: there are 400k files on my filesystem (nothing special). The code is sequential, so in theory it shouldn't even depend on the number of files.