Reduced memory usage
This commit is contained in:
@ -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)
|
||||
|
Reference in New Issue
Block a user