aboutsummaryrefslogtreecommitdiff
path: root/src/pkg/runtime/panic.c
diff options
context:
space:
mode:
authorDmitriy Vyukov <dvyukov@google.com>2014-07-22 01:56:19 +0400
committerDmitriy Vyukov <dvyukov@google.com>2014-07-22 01:56:19 +0400
commit7bcbdbd904eeaf671c608b183ae363dfa1b53ad6 (patch)
treebd4244a0e6dfe0b69063f3b86d4be5a3b4e5283f /src/pkg/runtime/panic.c
parent92c54e4a73cab47b53472d49479364f1378bbff7 (diff)
downloadgo-7bcbdbd904eeaf671c608b183ae363dfa1b53ad6.tar.xz
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
Diffstat (limited to 'src/pkg/runtime/panic.c')
-rw-r--r--src/pkg/runtime/panic.c2
1 files changed, 1 insertions, 1 deletions
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;