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

Issue 24251008: Add sk_calloc. Remove SkMemory_stdlib, which seems unused. (Closed)

Created:
7 years, 3 months ago by mtklein
Modified:
7 years, 3 months ago
Reviewers:
reed1
CC:
skia-review_googlegroups.com, bsalomon
Visibility:
Public.

Description

Add sk_calloc. Remove SkMemory_stdlib, which seems unused. I'm seeing basically no difference between malloc + bzero and calloc on my desktop, but on a Galaxy Nexus calloc is never slower, and significantly faster once the allocation size becomes large, both for allocation and for _reading_. BUG=skia:1662 R=reed@google.com Committed: https://code.google.com/p/skia/source/detail?r=11414

Patch Set 1 #

Patch Set 2 : add bench and test #

Total comments: 1

Patch Set 3 : bench now does create+free, create+read+free, create+write+free, create+read+write+free #

Patch Set 4 : update API #

Patch Set 5 : fix size_t #

Total comments: 2

Patch Set 6 : use sk_out_of_memory #

Unified diffs Side-by-side diffs Delta from patch set Stats (+156 lines, -281 lines) Patch
M bench/MemoryBench.cpp View 1 2 3 4 1 chunk +105 lines, -0 lines 0 comments Download
M gyp/tests.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download
M include/core/SkTypes.h View 1 2 3 4 5 2 chunks +9 lines, -1 line 0 comments Download
D src/core/SkMemory_stdlib.cpp View 1 chunk +0 lines, -267 lines 0 comments Download
M src/ports/SkMemory_malloc.cpp View 1 2 3 4 5 3 chunks +21 lines, -13 lines 0 comments Download
M src/ports/SkMemory_mozalloc.cpp View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
A tests/MemoryTest.cpp View 1 2 3 1 chunk +12 lines, -0 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
mtklein
7 years, 3 months ago (2013-09-19 20:28:27 UTC) #1
reed1
https://codereview.chromium.org/24251008/diff/3001/include/core/SkTypes.h File include/core/SkTypes.h (right): https://codereview.chromium.org/24251008/diff/3001/include/core/SkTypes.h#newcode69 include/core/SkTypes.h:69: SK_API extern void* sk_calloc(size_t num, size_t size); no way ...
7 years, 3 months ago (2013-09-19 20:48:09 UTC) #2
reed1
my wish-list: 1. crash and return-null variants 2. one size parameter, not two Don't really ...
7 years, 3 months ago (2013-09-19 20:52:58 UTC) #3
mtklein
On 2013/09/19 20:52:58, reed1 wrote: > my wish-list: > > 1. crash and return-null variants ...
7 years, 3 months ago (2013-09-20 14:10:18 UTC) #4
reed1
it is safe/legal to call realloc on a ptr returned from calloc? lgtm w/ suggestion ...
7 years, 3 months ago (2013-09-20 14:13:23 UTC) #5
mtklein
On 2013/09/20 14:13:23, reed1 wrote: > it is safe/legal to call realloc on a ptr ...
7 years, 3 months ago (2013-09-20 14:25:54 UTC) #6
mtklein
https://codereview.chromium.org/24251008/diff/11001/include/core/SkTypes.h File include/core/SkTypes.h (right): https://codereview.chromium.org/24251008/diff/11001/include/core/SkTypes.h#newcode71 include/core/SkTypes.h:71: /** Same as sk_calloc, but calls sk_throw() instead of ...
7 years, 3 months ago (2013-09-20 14:26:06 UTC) #7
mtklein
7 years, 3 months ago (2013-09-20 14:31:53 UTC) #8
Message was sent while issue was closed.
Committed patchset #6 manually as r11414 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698