[go-nuts] Golang map is getting corrupted with Memory mapped files

2017-05-17 Thread Tamás Gulácsi
I don't really understand what are you doing. You serialize with gob.Encode, but does NOT deserialize, just use the encoded bytes as the backing memory of an unitialized map. This won't work. Either deserialize with gob.Decode, or use your own custom data structure, which can be backed by

Re: [go-nuts] Golang map is getting corrupted with Memory mapped files

2017-05-17 Thread chaitanya reddy
Thanks Jan for the reply. So is there any way I can make this program to work? On Wednesday, May 17, 2017 at 6:15:12 AM UTC-7, Jan Mercl wrote: > > On Wed, May 17, 2017 at 2:49 PM chaitanya reddy > wrote: > > Maps must be initialized before mutating them, which the

Re: [go-nuts] Golang map is getting corrupted with Memory mapped files

2017-05-17 Thread Jan Mercl
On Wed, May 17, 2017 at 2:49 PM chaitanya reddy wrote: Maps must be initialized before mutating them, which the program does not do. However, when initializing a map it's not possible to chose where the map instance will be allocated neither where the map will acquire

[go-nuts] Golang map is getting corrupted with Memory mapped files

2017-05-17 Thread chaitanya reddy
Hi I was trying to write persistent map using mmap. But my map is getting corrupted by mmaps. I think I am using them wrongly. I need your advise. Thanks in advance. package main import ( "bytes" "encoding/gob" "fmt" "os" "syscall" "unsafe" )