Closed Bug 820132 Opened 12 years ago Closed 12 years ago

New DMD reports that some image allocs are unreported

Categories

(Core :: Graphics: ImageLib, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: justin.lebar+bug, Assigned: n.nethercote)

References

(Blocks 1 open bug)

Details

(Whiteboard: [MemShrink:P2])

Attachments

(1 file, 1 obsolete file)

In the main B2G process with the gallery app open (see attachment 690543 [details]), I see: > Unreported: ~16 blocks in block group 2 of 533 > ~1,536,000 bytes (~1,518,728 requested / ~17,272 slop) > 6.36% of the heap (14.95% cumulative); 12.53% of unreported (29.44% cumulative) > Allocated at > malloc /Users/jlebar/code/moz/ff-git/src/memory/build/replace_malloc.c:152 (0x4020b2ae libmozglue.so+0x42ae) > moz_malloc /Users/jlebar/code/moz/ff-git/src/memory/mozalloc/mozalloc.cpp:65 (0x40e5adf2 libxul.so+0xc37df2) > gfxImageSurface /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxImageSurface.cpp:110 (0x419ae7b6 libxul.so+0xa877b6) > nsRefPtr<gfxASurface>::assign_with_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:846 (0x419c3ac0 libxul.so+0xa9cac0) > gfxPlatform::OptimizeImage(gfxImageSurface*, gfxASurface::gfxImageFormat) /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxPlatform.cpp:464 (0x419bbbe4 libxul.so+0xa94be4) > nsRefPtr<gfxASurface>::assign_assuming_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:861 (0x4126637a libxul.so+0x33f37a) > mozilla::image::RasterImage::DecodingComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x41261f3a libxul.so+0x33af3a) > nsCOMPtr<imgIDecoderObserver>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:764 (0x4125fa90 libxul.so+0x338a90) > mozilla::image::nsPNGDecoder::end_callback(png_struct_def*, png_info_def*) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsPNGDecoder.cpp:860 (0x4126f3fe libxul.so+0x3483fe) > MOZ_PNG_push_have_end /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:1454 (0x40e35ce6 libxul.so+0xc12ce6) > MOZ_PNG_push_read_chunk /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:358 (0x40e36824 libxul.so+0xc13824) > MOZ_PNG_proc_some_data /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:122 (0x40e36a72 libxul.so+0xc13a72) > MOZ_PNG_process_data /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:38 (0x40e36ac0 libxul.so+0xc13ac0) > mozilla::image::nsPNGDecoder::WriteInternal(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsPNGDecoder.cpp:352 (0x4056b2da libxul.so+0x3482da) > mozilla::image::Decoder::Write(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/Decoder.cpp:80 (0x4055b9c0 libxul.so+0x3389c0) > mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2649 (0x4055d976 libxul.so+0x33a976) > mozilla::image::RasterImage::DecodeSomeData(unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3168 (0x4055da0c libxul.so+0x33aa0c) > mozilla::image::RasterImage::DecodeWorker::DecodeSomeOfImage(mozilla::image::RasterImage*, mozilla::image::RasterImage::DecodeWorker::DecodeType) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055e172 libxul.so+0x33b172) > mozilla::image::RasterImage::DecodeWorker::DecodeUntilSizeAvailable(mozilla::image::RasterImage*) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3429 (0x4055e2c8 libxul.so+0x33b2c8) > mozilla::image::RasterImage::SourceDataComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055f32e libxul.so+0x33c32e) > imgRequest::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) /Users/jlebar/code/moz/ff-git/src/image/src/imgRequest.cpp:656 (0x40567202 libxul.so+0x344202) > ProxyListener::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) /Users/jlebar/code/moz/ff-git/src/image/src/imgLoader.cpp:2063 (0x405628b4 libxul.so+0x33f8b4) > nsCOMPtr<nsIStreamListener>::operator=(nsIStreamListener*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:624 (0x40542c76 libxul.so+0x31fc76) > nsCOMPtr<nsIStreamListener>::operator=(nsIStreamListener*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:624 (0x404ad460 libxul.so+0x28a460)
Also the following trace, which I suspect is the same. > Unreported: 1 block in block group 6 of 533 > 614,400 bytes (614,400 requested / 0 slop) > 2.55% of the heap (27.36% cumulative); 5.01% of unreported (53.86% cumulative) > Allocated at > malloc /Users/jlebar/code/moz/ff-git/src/memory/build/replace_malloc.c:152 (0x4020b2ae libmozglue.so+0x42ae) > moz_malloc /Users/jlebar/code/moz/ff-git/src/memory/mozalloc/mozalloc.cpp:65 (0x40e5adf2 libxul.so+0xc37df2) > gfxImageSurface /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxImageSurface.cpp:110 (0x419ae7b6 libxul.so+0xa877b6) > nsRefPtr<gfxASurface>::assign_with_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:846 (0x419c3ac0 libxul.so+0xa9cac0) > gfxPlatform::OptimizeImage(gfxImageSurface*, gfxASurface::gfxImageFormat) /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxPlatform.cpp:464 (0x419bbbe4 libxul.so+0xa94be4) > nsRefPtr<gfxASurface>::assign_assuming_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:861 (0x4126637a libxul.so+0x33f37a) > mozilla::image::RasterImage::DecodingComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x41261f3a libxul.so+0x33af3a) > nsCOMPtr<imgIDecoderObserver>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:764 (0x4125fa90 libxul.so+0x338a90) > mozilla::image::nsPNGDecoder::end_callback(png_struct_def*, png_info_def*) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsPNGDecoder.cpp:860 (0x4126f3fe libxul.so+0x3483fe) > MOZ_PNG_push_have_end /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:1454 (0x40e35ce6 libxul.so+0xc12ce6) > MOZ_PNG_push_read_chunk /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:358 (0x40e36824 libxul.so+0xc13824) > MOZ_PNG_proc_some_data /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:122 (0x40e36a72 libxul.so+0xc13a72) > MOZ_PNG_process_data /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:38 (0x40e36ac0 libxul.so+0xc13ac0) > mozilla::image::nsPNGDecoder::WriteInternal(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsPNGDecoder.cpp:352 (0x4056b2da libxul.so+0x3482da) > mozilla::image::Decoder::Write(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/Decoder.cpp:80 (0x4055b9c0 libxul.so+0x3389c0) > mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2649 (0x4055d976 libxul.so+0x33a976) > mozilla::image::RasterImage::DecodeSomeData(unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3168 (0x4055da0c libxul.so+0x33aa0c) > mozilla::image::RasterImage::DecodeWorker::DecodeSomeOfImage(mozilla::image::RasterImage*, mozilla::image::RasterImage::DecodeWorker::DecodeType) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055e172 libxul.so+0x33b172) > mozilla::image::RasterImage::DecodeWorker::DecodeABitOf(mozilla::image::RasterImage*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:1005 (0x4055e414 libxul.so+0x33b414) > ~SamplerStackFramePrintfRAII /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/sps_sampler.h:221 (0x4126296c libxul.so+0x33b96c) > mozilla::image::RasterImage::StartDecoding() /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2706 (0x41260314 libxul.so+0x339314) > imgRequest::StartDecoding() /Users/jlebar/code/moz/ff-git/src/image/src/imgRequest.cpp:538 (0x4126a87e libxul.so+0x34387e) > imgRequestProxy::StartDecoding() /Users/jlebar/code/moz/ff-git/src/image/src/imgRequestProxy.cpp:361 (0x4126d27e libxul.so+0x34627e) > nsStyleImage::StartDecoding() const /Users/jlebar/code/moz/ff-git/src/layout/style/nsStyleStruct.cpp:1618 (0x41352b42 libxul.so+0x42bb42)
No longer blocks: slim-fast
> Unreported: 1 block in block group 8 of 533 > 307,200 bytes (307,200 requested / 0 slop) > 1.27% of the heap (30.80% cumulative); 2.51% of unreported (60.64% cumulative) > Allocated at > malloc /Users/jlebar/code/moz/ff-git/src/memory/build/replace_malloc.c:152 (0x4020b2ae libmozglue.so+0x42ae) > moz_malloc /Users/jlebar/code/moz/ff-git/src/memory/mozalloc/mozalloc.cpp:65 (0x40e5adf2 libxul.so+0xc37df2) > gfxImageSurface /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxImageSurface.cpp:110 (0x419ae7b6 libxul.so+0xa877b6) > nsRefPtr<gfxASurface>::assign_with_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:846 (0x419c3ac0 libxul.so+0xa9cac0) > gfxPlatform::OptimizeImage(gfxImageSurface*, gfxASurface::gfxImageFormat) /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxPlatform.cpp:464 (0x419bbbe4 libxul.so+0xa94be4) > nsRefPtr<gfxASurface>::assign_assuming_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:861 (0x4126637a libxul.so+0x33f37a) > mozilla::image::RasterImage::DecodingComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x41261f3a libxul.so+0x33af3a) > nsCOMPtr<imgIDecoderObserver>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:764 (0x4125fa90 libxul.so+0x338a90) > mozilla::image::nsPNGDecoder::end_callback(png_struct_def*, png_info_def*) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsPNGDecoder.cpp:860 (0x4126f3fe libxul.so+0x3483fe) > MOZ_PNG_push_have_end /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:1454 (0x40e35ce6 libxul.so+0xc12ce6) > MOZ_PNG_push_read_chunk /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:358 (0x40e36824 libxul.so+0xc13824) > MOZ_PNG_proc_some_data /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:122 (0x40e36a72 libxul.so+0xc13a72) > MOZ_PNG_process_data /Users/jlebar/code/moz/ff-git/src/media/libpng/pngpread.c:38 (0x40e36ac0 libxul.so+0xc13ac0) > mozilla::image::nsPNGDecoder::WriteInternal(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsPNGDecoder.cpp:352 (0x4056b2da libxul.so+0x3482da) > mozilla::image::Decoder::Write(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/Decoder.cpp:80 (0x4055b9c0 libxul.so+0x3389c0) > mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2649 (0x4055d976 libxul.so+0x33a976) > mozilla::image::RasterImage::DecodeSomeData(unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3168 (0x4055da0c libxul.so+0x33aa0c) > mozilla::image::RasterImage::DecodeWorker::DecodeSomeOfImage(mozilla::image::RasterImage*, mozilla::image::RasterImage::DecodeWorker::DecodeType) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055e172 libxul.so+0x33b172) > nsRefPtr<mozilla::image::RasterImage>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:1005 (0x4126232e libxul.so+0x33b32e) > nsThread::ProcessNextEvent(bool, bool*) /Users/jlebar/code/moz/ff-git/src/xpcom/threads/nsThread.cpp:627 (0x40c63c1e libxul.so+0xa40c1e) > NS_ProcessNextEvent_P(nsIThread*, bool) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x40c43dfa libxul.so+0xa20dfa) > mozilla::ipc::MessagePump::Run(base::MessagePump::Delegate*) /Users/jlebar/code/moz/ff-git/src/ipc/glue/MessagePump.cpp:83 (0x40b62008 libxul.so+0x93f008) > MessageLoop::RunInternal() /Users/jlebar/code/moz/ff-git/src/ipc/chromium/src/base/message_loop.cc:216 (0x40c85d40 libxul.so+0xa62d40) > ~AutoRunState /Users/jlebar/code/moz/ff-git/src/ipc/chromium/src/base/message_loop.cc:502 (0x40c85df6 libxul.so+0xa62df6) > > Unreported: 1 block in block group 9 of 533 > 307,200 bytes (307,200 requested / 0 slop) > 1.27% of the heap (32.08% cumulative); 2.51% of unreported (63.15% cumulative) > Allocated at > malloc /Users/jlebar/code/moz/ff-git/src/memory/build/replace_malloc.c:152 (0x4020b2ae libmozglue.so+0x42ae) > moz_malloc /Users/jlebar/code/moz/ff-git/src/memory/mozalloc/mozalloc.cpp:65 (0x40e5adf2 libxul.so+0xc37df2) > gfxImageSurface /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxImageSurface.cpp:110 (0x419ae7b6 libxul.so+0xa877b6) > nsRefPtr<gfxASurface>::assign_with_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:846 (0x419c3ac0 libxul.so+0xa9cac0) > gfxPlatform::OptimizeImage(gfxImageSurface*, gfxASurface::gfxImageFormat) /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxPlatform.cpp:464 (0x419bbbe4 libxul.so+0xa94be4) > nsRefPtr<gfxASurface>::assign_assuming_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:861 (0x4126637a libxul.so+0x33f37a) > mozilla::image::RasterImage::DecodingComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x41261f3a libxul.so+0x33af3a) > nsCOMPtr<imgIDecoderObserver>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:764 (0x4125fa90 libxul.so+0x338a90) > mozilla::image::nsJPEGDecoder::NotifyDone() /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:549 (0x4126fda6 libxul.so+0x348da6) > mozilla::image::term_source(jpeg_decompress_struct*) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:867 (0x4126fdb0 libxul.so+0x348db0) > jpeg_finish_decompress /Users/jlebar/code/moz/ff-git/src/media/libjpeg/jdapimin.c:393 (0x41b3ebb0 libxul.so+0xc17bb0) > mozilla::image::nsJPEGDecoder::WriteInternal(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:518 (0x4127035a libxul.so+0x34935a) > mozilla::image::Decoder::Write(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/Decoder.cpp:80 (0x4055b9c0 libxul.so+0x3389c0) > mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2649 (0x4055d976 libxul.so+0x33a976) > mozilla::image::RasterImage::DecodeSomeData(unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3168 (0x4055da0c libxul.so+0x33aa0c) > mozilla::image::RasterImage::DecodeWorker::DecodeSomeOfImage(mozilla::image::RasterImage*, mozilla::image::RasterImage::DecodeWorker::DecodeType) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055e172 libxul.so+0x33b172) > mozilla::image::RasterImage::DecodeWorker::DecodeABitOf(mozilla::image::RasterImage*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:1005 (0x4055e414 libxul.so+0x33b414) > ~SamplerStackFramePrintfRAII /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/sps_sampler.h:221 (0x4126296c libxul.so+0x33b96c) > mozilla::image::RasterImage::StartDecoding() /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2706 (0x41260314 libxul.so+0x339314) > imgRequest::StartDecoding() /Users/jlebar/code/moz/ff-git/src/image/src/imgRequest.cpp:538 (0x4126a87e libxul.so+0x34387e) > imgRequestProxy::StartDecoding() /Users/jlebar/code/moz/ff-git/src/image/src/imgRequestProxy.cpp:361 (0x4126d27e libxul.so+0x34627e) > nsDocument::AddImage(imgIRequest*) /Users/jlebar/code/moz/ff-git/src/content/base/src/nsDocument.cpp:8004 (0x413bc482 libxul.so+0x495482) > nsStyleContentData::TrackImage(nsPresContext*) /Users/jlebar/code/moz/ff-git/src/layout/style/nsStyleStruct.cpp:1502 (0x4064eaa2 libxul.so+0x42baa2) > nsRuleNode::ComputeBackgroundData(void*, nsRuleData const*, nsStyleContext*, nsRuleNode*, nsRuleNode::RuleDetail, bool) /Users/jlebar/code/moz/ff-git/src/layout/style/nsRuleNode.cpp:5702 (0x40646924 libxul.so+0x423924)
Whiteboard: [MemShrink]
I don't know if this is still useful, but here are two more sets of stacks from the gallery app. Together, these are ~43% of the gallery app's heap-unclassified. > Unreported: 49 blocks in block group 2 of 215 > 1,605,632 bytes (1,411,200 requested / 194,432 slop) > 12.66% of the heap (26.23% cumulative); 28.68% of unreported (59.40% cumulative) > Allocated at > malloc /Users/jlebar/code/moz/ff-git/src/memory/build/replace_malloc.c:152 (0x4020b2ae libmozglue.so+0x42ae) > moz_malloc /Users/jlebar/code/moz/ff-git/src/memory/mozalloc/mozalloc.cpp:65 (0x40e5adf2 libxul.so+0xc37df2) > gfxImageSurface /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxImageSurface.cpp:110 (0x419ae7b6 libxul.so+0xa877b6) > nsRefPtr<gfxASurface>::assign_with_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:846 (0x419c3ac0 libxul.so+0xa9cac0) > gfxPlatform::OptimizeImage(gfxImageSurface*, gfxASurface::gfxImageFormat) /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxPlatform.cpp:464 (0x419bbbe4 libxul.so+0xa94be4) > nsRefPtr<gfxASurface>::assign_assuming_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:861 (0x4126637a libxul.so+0x33f37a) > mozilla::image::RasterImage::DecodingComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x41261f3a libxul.so+0x33af3a) > nsCOMPtr<imgIDecoderObserver>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:764 (0x4125fa90 libxul.so+0x338a90) > mozilla::image::nsJPEGDecoder::NotifyDone() /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:549 (0x4126fda6 libxul.so+0x348da6) > mozilla::image::term_source(jpeg_decompress_struct*) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:867 (0x4126fdb0 libxul.so+0x348db0) > jpeg_finish_decompress /Users/jlebar/code/moz/ff-git/src/media/libjpeg/jdapimin.c:393 (0x41b3ebb0 libxul.so+0xc17bb0) > mozilla::image::nsJPEGDecoder::WriteInternal(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:518 (0x4127035a libxul.so+0x34935a) > mozilla::image::Decoder::Write(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/Decoder.cpp:80 (0x4055b9c0 libxul.so+0x3389c0) > mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2649 (0x4055d976 libxul.so+0x33a976) > mozilla::image::RasterImage::DecodeSomeData(unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3168 (0x4055da0c libxul.so+0x33aa0c) > mozilla::image::RasterImage::DecodeWorker::DecodeSomeOfImage(mozilla::image::RasterImage*, mozilla::image::RasterImage::DecodeWorker::DecodeType) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055e172 libxul.so+0x33b172) > mozilla::image::RasterImage::DecodeWorker::DecodeUntilSizeAvailable(mozilla::image::RasterImage*) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:3429 (0x4055e2c8 libxul.so+0x33b2c8) > mozilla::image::RasterImage::SourceDataComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4055f32e libxul.so+0x33c32e) > imgRequest::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) /Users/jlebar/code/moz/ff-git/src/image/src/imgRequest.cpp:656 (0x40567202 libxul.so+0x344202) > ProxyListener::OnStopRequest(nsIRequest*, nsISupports*, tag_nsresult) /Users/jlebar/code/moz/ff-git/src/image/src/imgLoader.cpp:2063 (0x405628b4 libxul.so+0x33f8b4) > nsCOMPtr<nsIStreamListener>::operator=(nsIStreamListener*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:624 (0x411acf58 libxul.so+0x285f58) > nsCOMPtr<nsIStreamListener>::operator=(nsIStreamListener*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:624 (0x404ad460 libxul.so+0x28a460) > nsInputStreamPump::OnInputStreamReady(nsIAsyncInputStream*) /Users/jlebar/code/moz/ff-git/src/netwerk/base/src/nsInputStreamPump.cpp:382 (0x404ad6c0 libxul.so+0x28a6c0) > nsCOMPtr<nsIOutputStreamCallback>::operator=(nsIOutputStreamCallback*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:624 (0x40c59896 libxul.so+0xa36896) > > Unreported: 25 blocks in block group 3 of 215 > 819,200 bytes (768,000 requested / 51,200 slop) > 6.46% of the heap (32.69% cumulative); 14.63% of unreported (74.03% cumulative) > Allocated at > malloc /Users/jlebar/code/moz/ff-git/src/memory/build/replace_malloc.c:152 (0x4020b2ae libmozglue.so+0x42ae) > moz_malloc /Users/jlebar/code/moz/ff-git/src/memory/mozalloc/mozalloc.cpp:65 (0x40e5adf2 libxul.so+0xc37df2) > gfxImageSurface /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxImageSurface.cpp:110 (0x419ae7b6 libxul.so+0xa877b6) > nsRefPtr<gfxASurface>::assign_with_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:846 (0x419c3ac0 libxul.so+0xa9cac0) > gfxPlatform::OptimizeImage(gfxImageSurface*, gfxASurface::gfxImageFormat) /Users/jlebar/code/moz/ff-git/src/gfx/thebes/gfxPlatform.cpp:464 (0x419bbbe4 libxul.so+0xa94be4) > nsRefPtr<gfxASurface>::assign_assuming_AddRef(gfxASurface*) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:861 (0x4126637a libxul.so+0x33f37a) > mozilla::image::RasterImage::DecodingComplete() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x41261f3a libxul.so+0x33af3a) > nsCOMPtr<imgIDecoderObserver>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:764 (0x4125fa90 libxul.so+0x338a90) > mozilla::image::nsJPEGDecoder::NotifyDone() /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:549 (0x4126fda6 libxul.so+0x348da6) > mozilla::image::term_source(jpeg_decompress_struct*) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:867 (0x4126fdb0 libxul.so+0x348db0) > jpeg_finish_decompress /Users/jlebar/code/moz/ff-git/src/media/libjpeg/jdapimin.c:393 (0x41b3ebb0 libxul.so+0xc17bb0) > mozilla::image::nsJPEGDecoder::WriteInternal(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/decoders/nsJPEGDecoder.cpp:518 (0x4127035a libxul.so+0x34935a) > mozilla::image::Decoder::Write(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/Decoder.cpp:80 (0x4055b9c0 libxul.so+0x3389c0) > mozilla::image::RasterImage::WriteToDecoder(char const*, unsigned int) /Users/jlebar/code/moz/ff-git/src/image/src/RasterImage.cpp:2649 (0x4055d976 libxul.so+0x33a976) > mozilla::image::RasterImage::SyncDecode() /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x404fe4e6 libxul.so+0x33b4e6) > mozilla::image::RasterImage::GetFrame(unsigned int, unsigned int, gfxASurface**) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x40500184 libxul.so+0x33d184) > nsLayoutUtils::SurfaceFromElement(nsIImageLoadingContent*, unsigned int) /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsError.h:155 (0x4054866a libxul.so+0x38566a) > ~nsCOMPtr /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsCOMPtr.h:453 (0x40548850 libxul.so+0x385850) > nsRefPtr<gfxASurface>::get() const /Users/jlebar/code/moz/B2G/objdir-gecko/dist/include/nsAutoPtr.h:1005 (0x406a598c libxul.so+0x4e298c) > mozilla::dom::CanvasRenderingContext2DBinding::drawImage(JSContext*, JS::Handle<JSObject*>, mozilla::dom::CanvasRenderingContext2D*, unsigned int, JS::Value*) /Users/jlebar/code/moz/B2G/objdir-gecko/dom/bindings/CanvasRenderingContext2DBinding.cpp:1593 (0x40b9a1fe libxul.so+0x9d71fe) > mozilla::dom::CanvasRenderingContext2DBinding::genericMethod(JSContext*, unsigned int, JS::Value*) /Users/jlebar/code/moz/B2G/objdir-gecko/dom/bindings/CanvasRenderingContext2DBinding.cpp:3245 (0x40b9b2cc libxul.so+0x9d82cc)
Assignee: nobody → n.nethercote
Whiteboard: [MemShrink] → [MemShrink:P2]
imgFrame::mOptSurface is reported in a way that DMD doesn't know about -- it uses gfxASurface::KnownMemoryUsed(), which uses a counter rather than a nsMallocSizeOfFun. To fix this requires implementing gfxASurface::SizeOfIncludingThis(). This is possible, but difficult. The main difficulty is that there are at least 12 sub-classes of gfxASurface. For this B2G case I think the surface is created via gfxAndroidPlatform::CreateOffscreenSurface, and the particular sub-class is gfxImageSurface, for which we already do have a reporter. So maybe it won't be so hard... I could just fallback to KnownMemoryUsed() for the other sub-classes.
This patch provides a mechanism whereby sub-classes of gfxASurface can indicate if they are able to measure their memory consumption with an nsMallocSizeOfFun. Currently gfxImageSurface is the only one that can, but that should be enough on Android for imgFrame::mOptSurface to be measured, because it is a gfxImageSurface. jlebar, I haven't confirmed this works because I don't have an Android device. (On Linux64, imgFrame::mOptSurface is a gfxXlibSurface, which is difficult to measure because it contains Cairo stuff.) If you run DMD on b2g hopefully those unreported blocks will become reported.
Attachment #693728 - Flags: review?(joe)
Attachment #693728 - Flags: feedback?(justin.lebar+bug)
BTW, this is another case where the memory is being reported, just not in a way that DMD knows about. So it won't necessarily reduce "heap-unclassified".
Just for kicks, here's a version that compiles.
Attachment #693759 - Flags: review?(joe)
Attachment #693728 - Attachment is obsolete: true
Attachment #693728 - Flags: review?(joe)
Attachment #693728 - Flags: feedback?(justin.lebar+bug)
Attachment #693759 - Flags: feedback?(justin.lebar+bug)
Comment on attachment 693759 [details] [diff] [review] Measure imgFrame::mOptSurface's size where possible, instead of calculating it. Review of attachment 693759 [details] [diff] [review]: ----------------------------------------------------------------- Q: Why is SizeOfIncludingThis() returning 0 not enough? That is to say, could we *not* add this extra virtual function, unconditionally call SizeOfIncludingThis(), and detect 0 as a "it doesn't work" condition? Presuming there is an answer to that, r=me. ::: gfx/thebes/gfxASurface.h @@ +201,5 @@ > virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf) const; > + // We have lots of sub-classes of gfxASurface. This method indicates if a > + // sub-class is capable of measuring its own size accurately. If not, we > + // fall back to a computed size (KnownMemoryUsed()). The default method > + // returns false, naturally. No need for that last sentence, as it's implied in, you know, the body of the function :)
Attachment #693759 - Flags: review?(joe) → review+
> That is to say, could we *not* add this extra virtual function, unconditionally call > SizeOfIncludingThis(), and detect 0 as a "it doesn't work" condition? I wondered the same thing, but it turns out that gfxASurface::SizeOfIncludingThis doesn't return 0 -- it returns aMallocSizeOf(this) + SizeOfExcludingThis().
We could check whether SizeOfExcludingThis() returns 0. :shrug:
Attachment #693759 - Flags: feedback?(justin.lebar+bug) → feedback+
> Q: Why is SizeOfIncludingThis() returning 0 not enough? That is to say, > could we *not* add this extra virtual function, unconditionally call > SizeOfIncludingThis(), and detect 0 as a "it doesn't work" condition? The problem is that 0 is an unclear signal -- does it mean "zero bytes" or does it mean "it doesn't work"? We have this in gfxASurface.cpp: size_t gfxASurface::SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf) const { // We don't measure mSurface because cairo doesn't allow it. return 0; } gfxASurface::SizeOfExcludingThis cannot sensibly both (a) measure itself, and (b) act as a "it doesn't work" default for sub-classes. So SizeOfIsMeasured() has to play the role of (b). (Actually, given that it returns 0 at the moment it can serve both roles, but that's a fluke of the overloading of 0, and if we ever changed it to measure gfxASurface::{mSurface,mOpaqueRect} it would no longer return 0 and things would break.) Now that I think about it, I can improve the "zero bytes" vs. "it doesn't work" distinction better in some other places in imgFrame.cpp. I'll do a follow-up patch.
Comment on attachment 693759 [details] [diff] [review] Measure imgFrame::mOptSurface's size where possible, instead of calculating it. bah, njn wanted me to actually /test/ this before giving f+.
Attachment #693759 - Flags: feedback+ → feedback?(justin.lebar+bug)
> Now that I think about it, I can improve the "zero bytes" vs. "it doesn't > work" distinction better in some other places in imgFrame.cpp. I'll do a > follow-up patch. Actually, that didn't work out. The current code is as good as it gets.
Comment on attachment 693759 [details] [diff] [review] Measure imgFrame::mOptSurface's size where possible, instead of calculating it. Verified that this works.
Attachment #693759 - Flags: feedback?(justin.lebar+bug) → feedback+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: