Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(99)

Issue 116940043: code review 116940043: runtime: pass correct size to malloc (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
6 years, 4 months ago by dvyukov
Modified:
6 years, 4 months ago
Reviewers:
khr, rsc
CC:
golang-codereviews, dfc, khr, khr1
Visibility:
Public.

Description

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.

Patch Set 1 #

Patch Set 2 : diff -r e1d0077340e8 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 3 : diff -r e1d0077340e8 https://dvyukov%40google.com@code.google.com/p/go/ #

Total comments: 2

Patch Set 4 : diff -r 82cbf874e066 https://dvyukov%40google.com@code.google.com/p/go/ #

Total comments: 2

Patch Set 5 : diff -r 72806f50d410 https://dvyukov%40google.com@code.google.com/p/go/ #

Patch Set 6 : diff -r e29388c4dad0 https://dvyukov%40google.com@code.google.com/p/go/ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+6 lines, -2 lines) Patch
M src/pkg/runtime/panic.c View 1 chunk +1 line, -1 line 0 comments Download
M src/pkg/runtime/slice.goc View 1 chunk +5 lines, -1 line 0 comments Download

Messages

Total messages: 10
dvyukov
Hello golang-codereviews@googlegroups.com (cc: khr@golang.org, rsc@golang.org), I'd like you to review this change to https://dvyukov%40google.com@code.google.com/p/go/
6 years, 4 months ago (2014-07-20 11:17:31 UTC) #1
dfc
testing on linux/arm now. https://codereview.appspot.com/116940043/diff/40001/src/pkg/runtime/slice.goc File src/pkg/runtime/slice.goc (right): https://codereview.appspot.com/116940043/diff/40001/src/pkg/runtime/slice.goc#newcode127 src/pkg/runtime/slice.goc:127: capmem = ret->cap*typ->size; I think ...
6 years, 4 months ago (2014-07-21 10:26:04 UTC) #2
dvyukov
https://codereview.appspot.com/116940043/diff/40001/src/pkg/runtime/slice.goc File src/pkg/runtime/slice.goc (right): https://codereview.appspot.com/116940043/diff/40001/src/pkg/runtime/slice.goc#newcode127 src/pkg/runtime/slice.goc:127: capmem = ret->cap*typ->size; On 2014/07/21 10:26:04, dfc wrote: > ...
6 years, 4 months ago (2014-07-21 12:14:51 UTC) #3
khr
https://codereview.appspot.com/116940043/diff/60001/src/pkg/runtime/slice.goc File src/pkg/runtime/slice.goc (right): https://codereview.appspot.com/116940043/diff/60001/src/pkg/runtime/slice.goc#newcode125 src/pkg/runtime/slice.goc:125: ret->len = x.len; I worry about setting len & ...
6 years, 4 months ago (2014-07-21 19:44:53 UTC) #4
dvyukov
https://codereview.appspot.com/116940043/diff/60001/src/pkg/runtime/slice.goc File src/pkg/runtime/slice.goc (right): https://codereview.appspot.com/116940043/diff/60001/src/pkg/runtime/slice.goc#newcode125 src/pkg/runtime/slice.goc:125: ret->len = x.len; On 2014/07/21 19:44:52, khr wrote: > ...
6 years, 4 months ago (2014-07-21 21:00:03 UTC) #5
khr1
I realize we'll have to fix it for concurrent GC. That's still a ways away. ...
6 years, 4 months ago (2014-07-21 21:14:41 UTC) #6
dvyukov
As you wish PTAL On 2014/07/21 21:14:41, khr1 wrote: > I realize we'll have to ...
6 years, 4 months ago (2014-07-21 21:44:09 UTC) #7
khr
On 2014/07/21 21:44:09, dvyukov wrote: > As you wish > PTAL > > On 2014/07/21 ...
6 years, 4 months ago (2014-07-21 21:45:05 UTC) #8
dvyukov
*** Submitted as https://code.google.com/p/go/source/detail?r=cc4f23ba86c7 *** runtime: pass correct size to malloc In both cases we ...
6 years, 4 months ago (2014-07-21 21:56:24 UTC) #9
rsc
6 years, 4 months ago (2014-07-22 03:34:33 UTC) #10
Message was sent while issue was closed.
FWIW I have a change pending that will make slice update order irrelevant. It is
very easy.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b