From d57c59236cf53035a2402f6656dba43ed4db8276 Mon Sep 17 00:00:00 2001 From: ian Date: Wed, 2 Jul 2014 14:23:45 +0000 Subject: [PATCH] PR go/61620 runtime: Don't free tiny blocks in map deletion. The memory allocator now has a special case for tiny blocks (smaller than 16 bytes) and they can not be explicitly freed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212233 138bc75d-0d04-0410-961f-82ee72b054a4 --- libgo/runtime/go-map-delete.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libgo/runtime/go-map-delete.c b/libgo/runtime/go-map-delete.c index f8f8907c345..de8b0469dea 100644 --- a/libgo/runtime/go-map-delete.c +++ b/libgo/runtime/go-map-delete.c @@ -8,6 +8,7 @@ #include #include "runtime.h" +#include "malloc.h" #include "go-alloc.h" #include "go-assert.h" #include "map.h" @@ -47,7 +48,8 @@ __go_map_delete (struct __go_map *map, const void *key) if (equalfn (key, entry + key_offset, key_size)) { *pentry = *(void **) entry; - __go_free (entry); + if (descriptor->__entry_size >= TinySize) + __go_free (entry); map->__element_count -= 1; break; } -- 2.11.4.GIT