Changeset 180359 in webkit


Ignore:
Timestamp:
Feb 19, 2015 12:42:52 PM (9 years ago)
Author:
ggaren@apple.com
Message:

bmalloc should implement malloc introspection (to stop false-positive leaks when MallocStackLogging is off)
https://bugs.webkit.org/show_bug.cgi?id=141802

Reviewed by Andreas Kling.

This patch does the bare minimum to stop false positive leaks from
being reported by the Darwin leaks tool. We register each super chunk
as a single object, and then request that the leaks tool scan it.

  • bmalloc.xcodeproj/project.pbxproj: Added an abstraction for the malloc

zone introspection API.

  • bmalloc/Algorithm.h: Missing #include.
  • bmalloc/VMHeap.cpp:

(bmalloc::VMHeap::grow):

  • bmalloc/VMHeap.h: Adopt the new abstraction.
  • bmalloc/Zone.cpp: Added.

(bmalloc::remoteRead): Helper for reading an object out of another process.
(bmalloc::Zone::enumerator):
(bmalloc::Zone::Zone): Register a malloc zone so that we will participate
in introspection.

  • bmalloc/Zone.h: Added.

(bmalloc::Zone::superChunks):
(bmalloc::Zone::addSuperChunk): Use a non-dynamically-allocated vector
since our dynamic allocations will not be scanned by leaks since they
will have the malloc VM tag.

Location:
trunk/Source/bmalloc
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/bmalloc/ChangeLog

    r180272 r180359  
     12015-02-19  Geoffrey Garen  <ggaren@apple.com>
     2
     3        bmalloc should implement malloc introspection (to stop false-positive leaks when MallocStackLogging is off)
     4        https://bugs.webkit.org/show_bug.cgi?id=141802
     5
     6        Reviewed by Andreas Kling.
     7
     8        This patch does the bare minimum to stop false positive leaks from
     9        being reported by the Darwin leaks tool. We register each super chunk
     10        as a single object, and then request that the leaks tool scan it.
     11
     12        * bmalloc.xcodeproj/project.pbxproj: Added an abstraction for the malloc
     13        zone introspection API.
     14
     15        * bmalloc/Algorithm.h: Missing #include.
     16
     17        * bmalloc/VMHeap.cpp:
     18        (bmalloc::VMHeap::grow):
     19        * bmalloc/VMHeap.h: Adopt the new abstraction.
     20
     21        * bmalloc/Zone.cpp: Added.
     22        (bmalloc::remoteRead): Helper for reading an object out of another process.
     23        (bmalloc::Zone::enumerator):
     24        (bmalloc::Zone::Zone): Register a malloc zone so that we will participate
     25        in introspection.
     26
     27        * bmalloc/Zone.h: Added.
     28        (bmalloc::Zone::superChunks):
     29        (bmalloc::Zone::addSuperChunk): Use a non-dynamically-allocated vector
     30        since our dynamic allocations will not be scanned by leaks since they
     31        will have the malloc VM tag.
     32
    1332015-02-18  Geoffrey Garen  <ggaren@apple.com>
    234
  • trunk/Source/bmalloc/bmalloc.xcodeproj/project.pbxproj

    r180272 r180359  
    1717                143CB81D19022BC900B16A45 /* StaticMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = 143CB81B19022BC900B16A45 /* StaticMutex.h */; settings = {ATTRIBUTES = (Private, ); }; };
    1818                1440AFC91A95142400837FAA /* SuperChunk.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440AFC81A95142400837FAA /* SuperChunk.h */; settings = {ATTRIBUTES = (Private, ); }; };
     19                1440AFCB1A95261100837FAA /* Zone.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440AFCA1A95261100837FAA /* Zone.h */; settings = {ATTRIBUTES = (Private, ); }; };
     20                1440AFCD1A9527AF00837FAA /* Zone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1440AFCC1A9527AF00837FAA /* Zone.cpp */; };
    1921                1448C30018F3754600502839 /* mbmalloc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1448C2FF18F3754300502839 /* mbmalloc.cpp */; };
    2022                1448C30118F3754C00502839 /* bmalloc.h in Headers */ = {isa = PBXBuildFile; fileRef = 1448C2FE18F3754300502839 /* bmalloc.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    9395                143E29ED18CAE90500FE8A0F /* SmallPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SmallPage.h; path = bmalloc/SmallPage.h; sourceTree = "<group>"; };
    9496                1440AFC81A95142400837FAA /* SuperChunk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SuperChunk.h; path = bmalloc/SuperChunk.h; sourceTree = "<group>"; };
     97                1440AFCA1A95261100837FAA /* Zone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Zone.h; path = bmalloc/Zone.h; sourceTree = "<group>"; };
     98                1440AFCC1A9527AF00837FAA /* Zone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Zone.cpp; path = bmalloc/Zone.cpp; sourceTree = "<group>"; };
    9599                144469E417A46BFE00F9EA1D /* Cache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; lineEnding = 0; name = Cache.cpp; path = bmalloc/Cache.cpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
    96100                144469E517A46BFE00F9EA1D /* Cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = Cache.h; path = bmalloc/Cache.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
     
    261265                                144F7BFB18BFC517003537F3 /* VMHeap.cpp */,
    262266                                144F7BFC18BFC517003537F3 /* VMHeap.h */,
     267                                1440AFCA1A95261100837FAA /* Zone.h */,
     268                                1440AFCC1A9527AF00837FAA /* Zone.cpp */,
    263269                        );
    264270                        name = heap;
     
    306312                                14DD788C18F48CAE00950702 /* LargeChunk.h in Headers */,
    307313                                14DD789218F48CFC00950702 /* EndTag.h in Headers */,
     314                                1440AFCB1A95261100837FAA /* Zone.h in Headers */,
    308315                                140FA00519CE4B6800FFD3C8 /* LineMetadata.h in Headers */,
    309316                                14DD78CC18F48D7500950702 /* PerThread.h in Headers */,
     
    434441                                14F271C518EA397E008C152F /* Deallocator.cpp in Sources */,
    435442                                14F271C418EA397B008C152F /* Cache.cpp in Sources */,
     443                                1440AFCD1A9527AF00837FAA /* Zone.cpp in Sources */,
    436444                        );
    437445                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/bmalloc/bmalloc/Algorithm.h

    r179927 r180359  
    2828
    2929#include "Algorithm.h"
     30#include "BAssert.h"
    3031#include <algorithm>
    3132#include <cstdint>
  • trunk/Source/bmalloc/bmalloc/VMHeap.cpp

    r180272 r180359  
    4141{
    4242    SuperChunk* superChunk = SuperChunk::create();
    43     m_superChunks.push(superChunk);
     43#if BPLATFORM(DARWIN)
     44    m_zone.addSuperChunk(superChunk);
     45#endif
    4446
    4547    SmallChunk* smallChunk = superChunk->smallChunk();
  • trunk/Source/bmalloc/bmalloc/VMHeap.h

    r180272 r180359  
    3535#include "SmallChunk.h"
    3636#include "Vector.h"
     37#if BPLATFORM(DARWIN)
     38#include "Zone.h"
     39#endif
    3740
    3841namespace bmalloc {
     
    6265    Vector<MediumPage*> m_mediumPages;
    6366    SegregatedFreeList m_largeRanges;
    64     Vector<SuperChunk*> m_superChunks;
     67#if BPLATFORM(DARWIN)
     68    Zone m_zone;
     69#endif
    6570};
    6671
Note: See TracChangeset for help on using the changeset viewer.