mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Add comments to ethsh.go to clarify mmp package usage.
This commit is contained in:
parent
0ad32d3be7
commit
378d314b25
1 changed files with 3 additions and 1 deletions
|
|
@ -64,6 +64,7 @@ func isLittleEndian() bool {
|
|||
}
|
||||
|
||||
// memoryMap tries to memory map a file of uint32s for read only access.
|
||||
// mmap is a portable memory map package which would enable direct access for memory mapping files
|
||||
func memoryMap(path string) (*os.File, mmap.MMap, []uint32, error) {
|
||||
file, err := os.OpenFile(path, os.O_RDONLY, 0644)
|
||||
if err != nil {
|
||||
|
|
@ -346,7 +347,8 @@ func (d *dataset) generate(dir string, limit int, test bool) {
|
|||
})
|
||||
}
|
||||
|
||||
// finalizer closes any file handlers and memory maps open.
|
||||
// finalizer closes any file handlers and use Unmap() to deletes the memory mapped region,
|
||||
// flushes any remaining changes.
|
||||
func (d *dataset) finalizer() {
|
||||
if d.mmap != nil {
|
||||
d.mmap.Unmap()
|
||||
|
|
|
|||
Loading…
Reference in a new issue