Reduced memory usage
This commit is contained in:
parent
8260839427
commit
e6ae755e60
2 changed files with 9 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue