Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Issue 182943002: - Actually allocate memory. (Closed)

Created:
6 years, 9 months ago by Ivan Posva
Modified:
6 years, 9 months ago
Reviewers:
Florian Schneider
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

- Actually allocate memory. Committed: https://code.google.com/p/dart/source/detail?r=33112

Patch Set 1 #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -1 line) Patch
M runtime/vm/cpuid.cc View 1 chunk +2 lines, -1 line 3 comments Download

Messages

Total messages: 4 (0 generated)
Ivan Posva
Committed patchset #1 manually as r33112.
6 years, 9 months ago (2014-02-27 09:57:49 UTC) #1
Florian Schneider
https://codereview.chromium.org/182943002/diff/1/runtime/vm/cpuid.cc File runtime/vm/cpuid.cc (right): https://codereview.chromium.org/182943002/diff/1/runtime/vm/cpuid.cc#newcode54 runtime/vm/cpuid.cc:54: reinterpret_cast<char*>(malloc(3 * 4 * sizeof(uint32_t))); If you use new ...
6 years, 9 months ago (2014-02-27 10:03:22 UTC) #2
Ivan Posva
-Ivan https://codereview.chromium.org/182943002/diff/1/runtime/vm/cpuid.cc File runtime/vm/cpuid.cc (right): https://codereview.chromium.org/182943002/diff/1/runtime/vm/cpuid.cc#newcode54 runtime/vm/cpuid.cc:54: reinterpret_cast<char*>(malloc(3 * 4 * sizeof(uint32_t))); On 2014/02/27 10:03:22, ...
6 years, 9 months ago (2014-02-27 10:13:41 UTC) #3
Florian Schneider
6 years, 9 months ago (2014-02-27 10:21:28 UTC) #4
Message was sent while issue was closed.
https://codereview.chromium.org/182943002/diff/1/runtime/vm/cpuid.cc
File runtime/vm/cpuid.cc (right):

https://codereview.chromium.org/182943002/diff/1/runtime/vm/cpuid.cc#newcode54
runtime/vm/cpuid.cc:54: reinterpret_cast<char*>(malloc(3 * 4 *
sizeof(uint32_t)));
On 2014/02/27 10:13:41, Ivan Posva wrote:
> On 2014/02/27 10:03:22, Florian Schneider wrote:
> > If you use new char[] and delete[] instead of malloc/free, this should avoid
> the
> > ugly casts.
> 
> Thank you for your insight. But the whole point of these changes was avoiding
> the mix of new char[], strdup (aka malloc) and delete[] since some allocators
to
> not appreciate that and will fail you at runtime.

Why use strdup then? I thought the point of returning a const char* is that the
string can't be changed by the caller - unless with a cast ofc.

Powered by Google App Engine
This is Rietveld 408576698