Open Bug 1241102 Opened 9 years ago Updated 2 years ago

Two memory allocation sites by WebGLTexture creation are not tracked (detected by DMD in heap-unclassified)

Categories

(Core :: Graphics: CanvasWebGL, defect, P3)

defect

Tracking

()

People

(Reporter: jujjyl, Unassigned)

References

(Blocks 1 open bug)

Details

(Whiteboard: [MemShrink:P2][gfx-noted])

Looking at a profile of an Emscripten Unity3D asm.js application, there are two callstacks related to WebGL texture creation going unreported in about:memory (shown under heap-unclassified). Unreported { ~168 blocks in heap block record 8 of 947 ~687,624 bytes (~687,624 requested / ~0 slop) Individual block sizes: ~4,093 x 168 0.24% of the heap (30.23% cumulative) 0.59% of unreported (74.94% cumulative) Allocated at { #01: malloc_impl (d:\gecko-dev\memory\build\replace_malloc.c:153) #02: moz_xmalloc (d:\gecko-dev\memory\mozalloc\mozalloc.cpp:83) #03: graphite2::gralloc<char> (d:\gecko-dev\gfx\graphite2\src\inc\main.h:89) #04: std::_Allocate<mozilla::SdpSsrcAttributeList::Ssrc> (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0:89) #05: std::allocator<std::pair<unsigned __int64,std::basic_string<char,std::char_traits<char>,std::allocator<char> > > >::allocate (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0:646) #06: std::_Wrap_alloc<std::allocator<mozilla::SdpSsrcAttributeList::Ssrc> >::allocate (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xmemory0:901) #07: std::_Tree_comp_alloc<std::_Tset_traits<google::protobuf::Descriptor const * __ptr64,std::less<google::protobuf::Descriptor const * __ptr64>,std::allocator<google::protobuf::Descriptor const * __ptr64>,0> >::_Buyheadnode (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree:825) #08: std::_Tree_comp_alloc<std::_Tset_traits<google::protobuf::Descriptor const * __ptr64,std::less<google::protobuf::Descriptor const * __ptr64>,std::allocator<google::protobuf::Descriptor const * __ptr64>,0> >::_Construct (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree:717) #09: std::_Tree_comp_alloc<std::_Tset_traits<google::protobuf::Descriptor const * __ptr64,std::less<google::protobuf::Descriptor const * __ptr64>,std::allocator<google::protobuf::Descriptor const * __ptr64>,0> >::_Tree_comp_alloc<std::_Tset_traits<google::prot (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree:705) #10: std::_Tree<std::_Tset_traits<google::protobuf::FileDescriptor const * __ptr64,std::less<google::protobuf::FileDescriptor const * __ptr64>,std::allocator<google::protobuf::FileDescriptor const * __ptr64>,0> >::_Tree<std::_Tset_traits<google::protobuf::File (c:\program files (x86)\microsoft visual studio 14.0\vc\include\xtree:1014) #11: std::set<CallDAG::CallDAGCreator::CreatorFunctionData * __ptr64,std::less<CallDAG::CallDAGCreator::CreatorFunctionData * __ptr64>,std::allocator<CallDAG::CallDAGCreator::CreatorFunctionData * __ptr64> >::set<CallDAG::CallDAGCreator::CreatorFunctionData * (c:\program files (x86)\microsoft visual studio 14.0\vc\include\set:71) #12: mozilla::WebGLTexture::ImageInfo::ImageInfo (d:\gecko-dev\dom\canvas\webgltexture.h:133) #13: `vector constructor iterator'[xul +0x2213b0] #14: mozilla::WebGLTexture::WebGLTexture (d:\gecko-dev\dom\canvas\webgltexture.cpp:144) #15: mozilla::WebGLContext::CreateTexture (d:\gecko-dev\dom\canvas\webglcontextgl.cpp:846) #16: mozilla::dom::WebGLRenderingContextBinding::createTexture (d:\gecko-dev\obj-x86_64-pc-mingw32\dom\bindings\webglrenderingcontextbinding.cpp:11837) #17: mozilla::dom::GenericBindingMethod (d:\gecko-dev\dom\bindings\bindingutils.cpp:2714) #18: ??? (???:???) } } Unreported { 72 blocks in heap block record 9 of 947 589,824 bytes (546,048 requested / 43,776 slop) Individual block sizes: 8,192 x 72 0.20% of the heap (30.44% cumulative) 0.51% of unreported (75.44% cumulative) Allocated at { #01: malloc_impl (d:\gecko-dev\memory\build\replace_malloc.c:153) #02: moz_xmalloc (d:\gecko-dev\memory\mozalloc\mozalloc.cpp:83) #03: graphite2::gralloc<char> (d:\gecko-dev\gfx\graphite2\src\inc\main.h:89) #04: mozilla::WebGLContext::CreateTexture (d:\gecko-dev\dom\canvas\webglcontextgl.cpp:846) #05: mozilla::dom::WebGLRenderingContextBinding::createTexture (d:\gecko-dev\obj-x86_64-pc-mingw32\dom\bindings\webglrenderingcontextbinding.cpp:11837) #06: mozilla::dom::GenericBindingMethod (d:\gecko-dev\dom\bindings\bindingutils.cpp:2714) #07: ??? (???:???) } } These take up 1 277 448 bytes total. Is it possible that this memory is being leaked? If not, it would be good to get it tracked in about:memory under the content process -> explicit -> window -> js-compartment -> classes -> class(WebGLTexture) where it looks like other WebGL classes also live (WebGLBuffer, WebgLRenderingContext, etc.), or something similar so that it doesn't count towards heap-unclassified?
Blocks: DarkMatter
That first stack looks pretty bizarre. Maybe it is best to ignore the top part of the stack...
Whiteboard: [MemShrink]
The first stack looks like it must be for mozilla::WebGLTexture::ImageInfo::mAttachPoints. I'd guess based on the stacks that this is the storage associated with the actual std::set. Adding memory reporting for this will require converting to an nsTHashtable. It might also be worth looking at whether these are really 4kb, or if that's just DMD sampling and they have a reasonable size. Assuming that these are mostly empty. The second stack looks like it might be for WebGLTexture. Maybe the WebGL context owns this so maybe that could be reported somehow.
Whiteboard: [MemShrink] → [MemShrink][gfx-noted]
Whiteboard: [MemShrink][gfx-noted] → [MemShrink:P2][gfx-noted]
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.