New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/gob: Encode() memory leak? #2067
Labels
Comments
Comment 1 by christopher.helck: I have created a simpler example that I've attached along with the output (gobble.txt). Problem seem very size sensitive. The program has a few loops that setup the initial data which is then saved over and over again. I've made the loop sizes as small as I can, while still having the program fail. It is possible that someone with different memory or hardware will need to adjust the loop counts. Basically err on the side of big. Failure is consistent. If it fails once it will always fail. One thing that is weird, the data file that is successfully written is very small <300 bytes. My sense is that the object being saved should be much bigger. Attachments:
|
Owner changed to @rsc. Status changed to Accepted. |
I have encountered a similar problem in a software I'm developing while using the latest weekly release (weekly.2010.02.14). So I've "gofixed" the code above (https://gist.github.com/1845614) and compiled it with the latest weekly release and I've got the following output: ------------------------------------------------------- Linux hostname 2.6.38-13-generic #54-Ubuntu SMP Tue Jan 3 13:44:52 UTC 2012 i686 i686 i386 GNU/Linux runtime: memory allocated by OS not in usable range runtime: memory allocated by OS not in usable range runtime: out of memory: cannot allocate 655360-byte block (536870912 in use) throw: out of memory goroutine 1 [running]: reflect.Value.MapKeys(0x80aa62c, 0x32ad53b0, 0x156, 0x80cd1b8, 0x8078cc5, ...) /home/sb/go/src/pkg/reflect/value.go:970 +0x130 encoding/gob.(*Encoder).encodeMap(0x24efb380, 0x24efb3a0, 0x80aa62c, 0x32ad53b0, 0x156, ...) /home/sb/go/src/pkg/encoding/gob/encode.go:414 +0x5c encoding/gob._func_015(0x188e2ee8, 0x188e2ef0, 0x188e2f08, 0x188e2ef8, 0x188e2f10, ...) /home/sb/go/src/pkg/encoding/gob/encode.go:601 +0x136 encoding/gob.(*Encoder).encodeSingle(0x24efb380, 0x24efb3a0, 0x18638490, 0x32ad53b0, 0x80aa62c, ...) /home/sb/go/src/pkg/encoding/gob/encode.go:354 +0xa9 encoding/gob.(*Encoder).encode(0x24efb380, 0x24efb3a0, 0x80aa62c, 0x1861cbc0, 0x150, ...) /home/sb/go/src/pkg/encoding/gob/encode.go:729 +0x189 encoding/gob.(*Encoder).EncodeValue(0x24efb380, 0x80aa62c, 0x1861cbc0, 0x150, 0x0, ...) /home/sb/go/src/pkg/encoding/gob/encoder.go:246 +0x1fb encoding/gob.(*Encoder).Encode(0x24efb380, 0x80aa624, 0x1861cbc0, 0x1861cbc0, 0x32ad53a0, ...) /home/sb/go/src/pkg/encoding/gob/encoder.go:177 +0x52 main.save(0x18600358, 0x0, 0x0) /home/sb/gobl/test.go:24 +0xbd main.main() /home/sb/gobl/test.go:30 +0x32 ------------------------------------------------------- I've tried to increase arena_size in runtime/malloc.goc, but it had no effect. So it seems to me that the issue is still present on 32 bit architectures. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by christopher.helck:
Attachments:
The text was updated successfully, but these errors were encountered: