Closed Bug 914190 Opened 9 years ago Closed 9 years ago

Avoid C getline() in profiler due to Android JB malloc conflict

Categories

(Core :: Gecko Profiler, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: jld, Assigned: jld)

References

Details

(Keywords: perf, Whiteboard: [c=profiling p=2 s= u=])

Attachments

(1 file, 1 obsolete file)

We can't use getline() from Gecko on Android Jelly Bean because it calls bionic's realloc (not overrideable, despite having default visbility), and the caller needs to free() the result, and that will use jemalloc's free().

So, write a getline(), or import someone else's, and add it to libmozglue.

In particular, the Gecko profiler won't work on JB until this is fixed.
That one doesn't handle lines that are larger than 4096 bytes.

As it happens I also wrote a getline(), when I was parsing /proc files for miniperf-record, in my fork of gonk-misc; looking at it again, it's wrong in that it tries to add a '\n' if the file ends in the middle of a line, but that's easier to fix, and I think it conforms other than that.

And since we're overriding any getline() calls anywhere in Gecko, not just the one in the profiler, we probably need to make sure all the cases are covered.
Blocks: 895154, gonk-jb
Summary: Add getline to libmozglue → Add getline to libmozglue (blocks Gecko profiler on JB B2G)
Status: NEW → ASSIGNED
Keywords: perf
Whiteboard: [c=profiler p= s= u=]
Whiteboard: [c=profiler p= s= u=] → [c=profiling p= s= u=]
Component: General → mozglue
Product: Boot2Gecko → Core
Version: unspecified → Trunk
OS: Linux → Gonk (Firefox OS)
Hardware: x86_64 → ARM
Attachment #808081 - Flags: review?(mh+mozilla)
Comment on attachment 808081 [details] [diff] [review]
bug914190-getline-mozglue-hg0.diff

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

It feels to me you should just use std::getline.
Attachment #808081 - Flags: review?(mh+mozilla) → review-
Blocks: 937364
Component: mozglue → Gecko Profiler
Summary: Add getline to libmozglue (blocks Gecko profiler on JB B2G) → Avoid C getline() in profiler due to Android JB malloc conflict
Attachment #808081 - Attachment is obsolete: true
Attachment #830532 - Flags: review?(bgirard)
Attachment #830532 - Flags: review?(bgirard) → review+
Keywords: checkin-needed
Whiteboard: [c=profiling p= s= u=] → [c=profiling p=2 s= u=]
Belated checkin note: for b2g-inbound.
https://hg.mozilla.org/mozilla-central/rev/244e9253af07
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in before you can comment on or make changes to this bug.