Closed Bug 1466693 Opened 2 years ago Closed 2 years ago

Use system malloc instead of js_malloc in the shell's SetOutputFile function

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file)

SetOutputFile is called before jemalloc is initialized, therefore it's not possible to use js_malloc at this point.
Attached patch bug1466693.patchSplinter Review
Without this change ArenaCollection::GetById(...) asserts with:
---
0x00000000004d6f7d in ArenaCollection::GetById (this=0x2bc6190 <gArenas>, aArenaId=0, aIsPrivate=true) at /home/andre/git/mozilla-central/memory/build/mozjemalloc.cpp:4560
4560      MOZ_RELEASE_ASSERT(result);
(gdb) bt
#0  0x00000000004d6f7d in ArenaCollection::GetById(unsigned long, bool) (this=0x2bc6190 <gArenas>, aArenaId=0, aIsPrivate=true) at /home/andre/git/mozilla-central/memory/build/mozjemalloc.cpp:4560
#1  0x00000000004cdb38 in Allocator<MozJemallocBase>::moz_arena_malloc(unsigned long, unsigned long) (aArenaId=0, arg1=16) at /home/andre/git/mozilla-central/memory/build/malloc_decls.h:37
#2  0x00000000004c8ccd in moz_arena_malloc(arena_id_t, size_t) (arg1=0, arg2=16) at /home/andre/git/mozilla-central/memory/build/malloc_decls.h:115
#3  0x0000000000451c13 in js_malloc(unsigned long) (bytes=16) at /home/andre/git/mozilla-central/js/src/build-debug-master/dist/include/js/Utility.h:388
#4  0x000000000045cd6b in js_new<js::shell::RCFile, _IO_FILE*&>(_IO_FILE*&) (args=@0x7fffffffd530: 0x7ffff6917c00)
    at /home/andre/git/mozilla-central/js/src/build-debug-master/dist/include/js/Utility.h:504
#5  0x00000000004545a0 in SetOutputFile(char const*, js::shell::RCFile*, js::shell::RCFile**) (envVar=0x18a6b58 "JS_STDERR", defaultOut=0x7fffffffd770, outFileP=0x2bc5fc0 <gErrFile>)
    at /home/andre/git/mozilla-central/js/src/shell/js.cpp:8928
#6  0x0000000000452c84 in main(int, char**, char**) (argc=3, argv=0x7fffffffd898, envp=0x7fffffffd8b8) at /home/andre/git/mozilla-central/js/src/shell/js.cpp:9002
---
Attachment #8983231 - Flags: review?(sphink)
Comment on attachment 8983231 [details] [diff] [review]
bug1466693.patch

Review of attachment 8983231 [details] [diff] [review]:
-----------------------------------------------------------------

Makes sense, thanks.
Attachment #8983231 - Flags: review?(sphink) → review+
Keywords: checkin-needed
Pushed by ebalazs@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/6d859a75b7cc
Use system malloc in SetOutputFile because jemalloc isn't yet initialized. r=sfink
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/6d859a75b7cc
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.