Commit 9490fda6 by Ian Lance Taylor

re PR go/61620 (FAIL: go.test/test/fixedbugs/bug242.go execution, -O2 -g)

	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.

From-SVN: r212233
parent 513c5c74
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "runtime.h" #include "runtime.h"
#include "malloc.h"
#include "go-alloc.h" #include "go-alloc.h"
#include "go-assert.h" #include "go-assert.h"
#include "map.h" #include "map.h"
...@@ -47,6 +48,7 @@ __go_map_delete (struct __go_map *map, const void *key) ...@@ -47,6 +48,7 @@ __go_map_delete (struct __go_map *map, const void *key)
if (equalfn (key, entry + key_offset, key_size)) if (equalfn (key, entry + key_offset, key_size))
{ {
*pentry = *(void **) entry; *pentry = *(void **) entry;
if (descriptor->__entry_size >= TinySize)
__go_free (entry); __go_free (entry);
map->__element_count -= 1; map->__element_count -= 1;
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment