From 7bcbdbd904eeaf671c608b183ae363dfa1b53ad6 Mon Sep 17 00:00:00 2001 From: Dmitriy Vyukov Date: Tue, 22 Jul 2014 01:56:19 +0400 Subject: runtime: pass correct size to malloc In both cases we lie to malloc about the actual size that we need. In panic we ask for less memory than we are going to use. In slice we ask for more memory than we are going to use (potentially asking for a fractional number of elements). This breaks the new GC. LGTM=khr R=golang-codereviews, dave, khr CC=golang-codereviews, rsc https://golang.org/cl/116940043 --- src/pkg/runtime/panic.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pkg/runtime/panic.c') diff --git a/src/pkg/runtime/panic.c b/src/pkg/runtime/panic.c index ce05725037..47e9566278 100644 --- a/src/pkg/runtime/panic.c +++ b/src/pkg/runtime/panic.c @@ -41,7 +41,7 @@ newdefer(int32 siz) } if(d == nil) { // deferpool is empty or just a big defer - total = TOTALSIZE(siz); + total = runtimeĀ·roundupsize(TOTALSIZE(siz)); d = runtimeĀ·malloc(total); } d->siz = siz; -- cgit v1.3-5-g9baa