]> Cypherpunks repositories - gostls13.git/commit
runtime: fix map memory leak
authorRuss Cox <rsc@golang.org>
Sat, 1 Oct 2011 17:00:53 +0000 (13:00 -0400)
committerRuss Cox <rsc@golang.org>
Sat, 1 Oct 2011 17:00:53 +0000 (13:00 -0400)
commite7e5c5adb3d30cd096cdce11987abe92b79d24ce
tree8aa46ef4e41415572e60d4a4f8f9d2edb42f3f0e
parent71517e7b4acc12a426ebe0b45899a8ba19784ae9
runtime: fix map memory leak

The map implementation was using the C idiom of using
a pointer just past the end of its table as a limit pointer.
Unfortunately, the garbage collector sees that pointer as
pointing at the block adjacent to the map table, pinning
in memory a block that would otherwise be freed.

Fix by making limit pointer point at last valid entry, not
just past it.

Reviewed by Mike Burrows.

R=golang-dev, bradfitz, lvd, r
CC=golang-dev
https://golang.org/cl/5158045
src/cmd/ld/dwarf.c
src/pkg/runtime/hashmap.c
src/pkg/runtime/hashmap.h
src/pkg/runtime/runtime-gdb.py