Closed Bug 1273301 Opened 8 years ago Closed 7 years ago

Use DMD to record allocations during a specific segment of the code

Categories

(Core :: DMD, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE
Tracking Status
firefox49 --- affected

People

(Reporter: mccr8, Assigned: mccr8)

References

Details

Attachments

(2 files)

I'm looking at temporary increases in memory usage during IPC serialization/deserialization. I'd like to be able to record all allocations during a certain part of the code, with a StartRecording() and StopRecording() kind of thing. It turns out this is reasonably easy to implement this by misusing dmd::ResetEverything().

The stacks I'm getting are bogus. I'm not sure if I'm just having some problem with DMD, or if the way I'm using ResetEverything is causing issues.
Attached file example allocation log
I had to use GCC because Clang was giving me weird stacks.

I might hack up an "Analyze and Reset" method because with my current approach you get some noise from the actual logging process.
Anyways, in the log, you can see pretty easily the redundant allocation that is happening: there are 3 separate buffers of 8,192 bytes, inside CacheFileChunk::EnsureBufSize(), Pickle::Resize() and the nsCString that NS_ReadInputStreamToString() stores data into.
This isn't something that needs to be tracked for e10s, because it is just a local diagnostic tool, but I thought I'd make it block bug 1262918 to give it more visibility.

The patch here is a little problematic. The GCing that DMD does causes a UAF crash with this patch, so I just commented it out. I was also hitting a JS assertion from adding something to the hash table of allocated addresses that is already in there. I have no idea how that could happen.
Blocks: 1262918
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: