Open Bug 1407636 Opened 7 years ago Updated 2 years ago

Using blobs in a page loaded in a content process causes a large amount of heap-unclassified memory in the parent process

Categories

(Core :: DOM: Content Processes, defect, P3)

defect

Tracking

()

People

(Reporter: florian, Unassigned)

References

Details

Having a page showing ~500 images (2.3GB worth of PNG data) in a content process using blobs causes ~2.3GB of heap-unclassified memory in the parent process.

About:memory says:

Main Process
2,581.84 MB (100.0%) -- explicit
├──2,330.74 MB (90.27%) ── heap-unclassified
...


file:// Content (pid 18503)
4,616.91 MB (100.0%) -- explicit
├──2,277.88 MB (49.34%) -- images
│  ├──2,277.88 MB (49.34%) ++ content/raster/used
│  └──────0.00 MB (00.00%) ++ chrome/raster/used/<non-notable images>
├──2,277.86 MB (49.34%) -- dom
│  ├──2,277.79 MB (49.34%) ++ memory-file-data/large



DMD for the main process shows:

Unreported {
  579,571 blocks in heap block record 1 of 7,112
  2,373,922,816 bytes (2,373,922,816 requested / 0 slop)
  Individual block sizes: 4,096 x 579,571
  92.13% of the heap (92.13% cumulative)
  96.81% of unreported (96.81% cumulative)
  Allocated at {
    #01: replace_malloc (DMD.cpp:1303, in libdmd.dylib)
    #02: nsSegmentedBuffer::AppendNewSegment() (nsSegmentedBuffer.cpp:67, in XUL)
    #03: nsPipe::GetWriteSegment(char*&, unsigned int&) (nsPipe3.cpp:886, in XUL)
    #04: nsPipeOutputStream::WriteSegments(nsresult (*)(nsIOutputStream*, void*, char*, unsigned int, unsigned int, unsigned int*), void*, unsigned int, unsigned int*) (nsPipe3.cpp:1805, in XUL)
    #05: mozilla::ipc::(anonymous namespace)::IPCStreamDestinationParent::RecvBuffer(mozilla::wr::ByteBuffer const&) (IPCStreamDestination.cpp:362, in XUL)
    #06: mozilla::ipc::PChildToParentStreamParent::OnMessageReceived(IPC::Message const&) (PChildToParentStreamParent.cpp:133, in XUL)
    #07: mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) (MessageChannel.h:635, in XUL)
    #08: mozilla::ipc::MessageChannel::DispatchMessage(IPC::Message&&) (MessageChannel.cpp:2049, in XUL)
  }
}

Unreported {
  101 blocks in heap block record 2 of 7,112
  21,168,128 bytes (21,168,128 requested / 0 slop)
  Individual block sizes: 262,144 x 68; 131,072 x 18; 65,536 x 15
  0.82% of the heap (92.96% cumulative)
  0.86% of unreported (97.67% cumulative)
  Allocated at {
    #01: replace_malloc (DMD.cpp:1303, in libdmd.dylib)
    #02: nsTSubstring<char>::MutatePrep(unsigned int, char**, mozilla::detail::StringDataFlags*) (nsSubstring.cpp:239, in XUL)
    #03: nsTSubstring<char>::SetCapacity(unsigned int, mozilla::fallible_t const&) (nsTSubstring.cpp:726, in XUL)
    #04: nsTSubstring<char>::SetLength(unsigned int) (nsTSubstring.cpp:706, in XUL)
    #05: IPC::ParamTraits<nsTSubstring<char> >::Read(IPC::Message const*, PickleIterator*, nsTSubstring<char>*) (nsTSubstring.h:88, in XUL)
    #06: mozilla::dom::PContentParent::Read(mozilla::ipc::InputStreamParams*, IPC::Message const*, PickleIterator*) (PContentParent.cpp:10611, in XUL)
    #07: mozilla::dom::PContentParent::Read(mozilla::ipc::InputStreamParamsWithFds*, IPC::Message const*, PickleIterator*) (PContentParent.cpp:17304, in XUL)
    #08: mozilla::dom::PContentParent::Read(mozilla::ipc::IPCStream*, IPC::Message const*, PickleIterator*) (PContentParent.cpp:17730, in XUL)
  }
}

Unreported {
  144,603 blocks in heap block record 3 of 7,112
  10,392,920 bytes (9,920,697 requested / 472,223 slop)
  Individual block sizes: 4,096; 1,024 x 97; 512 x 188; 496 x 146; 480 x 14; 464 x 6; 448 x 92; 432 x 4; 416 x 16; 400 x 118; 384 x 64; 368 x 43; 352 x 28; 336 x 265; 320 x 92; 304 x 41; 288 x 190; 272 x 1,457; 256 x 1,466; 240 x 1,092; 224 x 368; 208 x 1,507; 192 x 2,252; 176 x 1,284; 160 x 1,874; 144 x 3,314; 128 x 8,772; 112 x 3,968; 96 x 5,312; 80 x 8,361; 64 x 26,097; 48 x 23,372; 32 x 35,056; 16 x 14,065; 8 x 3,581
  0.40% of the heap (93.36% cumulative)
  0.42% of unreported (98.10% cumulative)
  Allocated at {
    #01: (no stack trace recorded due to --stacks=partial)
  }
}

Unreported {
  549 blocks in heap block record 4 of 7,112
  8,986,624 bytes (8,986,624 requested / 0 slop)
  Individual block sizes: 16,384 x 548; 8,192
  0.35% of the heap (93.71% cumulative)
  0.37% of unreported (98.46% cumulative)
  Allocated at {
    #01: replace_realloc (DMD.cpp:1351, in libdmd.dylib)
    #02: moz_xrealloc (mozalloc.cpp:107, in libmozglue.dylib)
    #03: nsSegmentedBuffer::AppendNewSegment() (nsSegmentedBuffer.cpp:56, in XUL)
    #04: nsPipe::GetWriteSegment(char*&, unsigned int&) (nsPipe3.cpp:886, in XUL)
    #05: nsPipeOutputStream::WriteSegments(nsresult (*)(nsIOutputStream*, void*, char*, unsigned int, unsigned int, unsigned int*), void*, unsigned int, unsigned int*) (nsPipe3.cpp:1805, in XUL)
    #06: mozilla::ipc::(anonymous namespace)::IPCStreamDestinationParent::RecvBuffer(mozilla::wr::ByteBuffer const&) (IPCStreamDestination.cpp:362, in XUL)
    #07: mozilla::ipc::PChildToParentStreamParent::OnMessageReceived(IPC::Message const&) (PChildToParentStreamParent.cpp:133, in XUL)
    #08: mozilla::ipc::MessageChannel::DispatchAsyncMessage(IPC::Message const&) (MessageChannel.h:635, in XUL)
  }
}
Seems like we should at least have a memory reporter for this on IPCStreamDestination.

That said, it's a little weird that we're keeping all this stuff in-memory... :(
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.