Closed
Bug 1423461
Opened 7 years ago
Closed 7 years ago
More cleanups in mozalloc
Categories
(Core :: Memory Allocator, enhancement)
Core
Memory Allocator
Tracking
()
RESOLVED
FIXED
mozilla59
Tracking | Status | |
---|---|---|
firefox59 | --- | fixed |
People
(Reporter: glandium, Assigned: glandium)
References
Details
Attachments
(4 files)
No description provided.
Assignee | ||
Updated•7 years ago
|
Assignee: nobody → mh+mozilla
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Updated•7 years ago
|
Summary: More cleanups in mozalloc.h → More cleanups in mozalloc
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Comment 6•7 years ago
|
||
mozreview-review |
Comment on attachment 8934836 [details] Bug 1423461 - Remove MOZALLOC_INLINE, and always use MOZ_ALWAYS_INLINE_EVEN_DEBUG. https://reviewboard.mozilla.org/r/205758/#review211360
Attachment #8934836 -
Flags: review?(n.nethercote) → review+
Comment 7•7 years ago
|
||
mozreview-review |
Comment on attachment 8934837 [details] Bug 1423461 - Use noexcept in mozalloc.h on android. https://reviewboard.mozilla.org/r/205760/#review211362
Attachment #8934837 -
Flags: review?(n.nethercote) → review+
Comment 8•7 years ago
|
||
mozreview-review |
Comment on attachment 8934845 [details] Bug 1423461 - Use mozilla/Likely.h in mozalloc.cpp. https://reviewboard.mozilla.org/r/205768/#review211364 ::: commit-message-b9f84:3 (Diff revision 1) > +Bug 1423461 - Use mozilla/Likely.h in mozalloc.cpp. r?njn > + > +Back when mozalloc.cpp was written, mozilla/Likely didn't exist. Likely.h
Attachment #8934845 -
Flags: review?(n.nethercote) → review+
Comment 9•7 years ago
|
||
mozreview-review |
Comment on attachment 8934846 [details] Bug 1423461 - Report the right size to the OOM handler for moz_xcalloc. https://reviewboard.mozilla.org/r/205770/#review211366 ::: memory/mozalloc/mozalloc.cpp:84 (Diff revision 2) > moz_xcalloc(size_t nmemb, size_t size) > { > void* ptr = calloc_impl(nmemb, size); > if (MOZ_UNLIKELY(!ptr && nmemb && size)) { > - mozalloc_handle_oom(size); > + mozilla::CheckedInt<size_t> totalSize = mozilla::CheckedInt<size_t>(nmemb) * size; > + mozalloc_handle_oom(totalSize.isValid() ? totalSize.value() : SIZE_MAX); I'm trying to decide if SIZE_MAX is appropriate here. It doesn't feel quite right but I don't know what other value would be better. (Relatedly, the `!ptr && nmemb && size` test suggests that if you ask for zero bytes you'll get a null pointer back, but that's not true for mozjemalloc. Maybe it's true for other allocators.)
Attachment #8934846 -
Flags: review?(n.nethercote) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 12•7 years ago
|
||
(In reply to Nicholas Nethercote [:njn] from comment #9) > (Relatedly, the `!ptr && nmemb && size` test suggests that if you ask for > zero bytes you'll get a null pointer back, but that's not true for > mozjemalloc. Maybe it's true for other allocators.) The code is generic for both enabled and disabled mozjemalloc, and the contract for allocation functions is that they may return null or a pointer that can be freed, so better safe than sorry.
Comment 13•7 years ago
|
||
Pushed by mh@glandium.org: https://hg.mozilla.org/integration/autoland/rev/2d83c8873923 Remove MOZALLOC_INLINE, and always use MOZ_ALWAYS_INLINE_EVEN_DEBUG. r=njn https://hg.mozilla.org/integration/autoland/rev/98b79b9db69e Use noexcept in mozalloc.h on android. r=njn https://hg.mozilla.org/integration/autoland/rev/e35fce376c40 Use mozilla/Likely.h in mozalloc.cpp. r=njn https://hg.mozilla.org/integration/autoland/rev/6d34adb031e5 Report the right size to the OOM handler for moz_xcalloc. r=njn
Comment 14•7 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/2d83c8873923 https://hg.mozilla.org/mozilla-central/rev/98b79b9db69e https://hg.mozilla.org/mozilla-central/rev/e35fce376c40 https://hg.mozilla.org/mozilla-central/rev/6d34adb031e5
Status: NEW → RESOLVED
Closed: 7 years ago
status-firefox59:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in
before you can comment on or make changes to this bug.
Description
•