Reduced memory usage

This commit is contained in:
2024-06-20 11:29:39 +02:00
parent 9b50c917e9
commit ff2a43e593
2 changed files with 9 additions and 3 deletions

View File

@ -5,8 +5,6 @@ import (
"unsafe"
)
const blockSize = 4096
// Walk calls your callback function for every file name inside the directory.
// It doesn't distinguish between files and directories.
func Walk(directory string, callBack func(string)) error {
@ -17,7 +15,7 @@ func Walk(directory string, callBack func(string)) error {
}
defer syscall.Close(fd)
buffer := make([]byte, blockSize)
buffer := make([]byte, 1024)
for {
n, err := syscall.ReadDirent(fd, buffer)