File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -742,6 +742,10 @@ if (NOT USE_SYSTEM_MALLOC)
742742 set (WTF_FRAMEWORKS bmalloc)
743743endif ()
744744
745+ if (ENABLE_MALLOC_HEAP_BREAKDOWN)
746+ list (APPEND WTF_LIBRARIES ${MALLOC_ZONE_LIBRARIES} )
747+ endif ()
748+
745749if (ATOMICS_REQUIRE_LIBATOMIC)
746750 list (APPEND WTF_LIBRARIES atomic)
747751endif ()
Original file line number Diff line number Diff line change 3030
3131#if ENABLE(MALLOC_HEAP_BREAKDOWN)
3232#include < mutex>
33- #if OS(DARWIN)
3433#include < malloc/malloc.h>
3534#endif
36- #endif
3735
3836namespace WTF {
3937
@@ -53,9 +51,7 @@ class DebugHeap {
5351 WTF_EXPORT_PRIVATE void free (void *);
5452
5553private:
56- #if OS(DARWIN)
5754 malloc_zone_t * m_zone;
58- #endif
5955};
6056
6157#define DECLARE_ALLOCATOR_WITH_HEAP_IDENTIFIER_AND_EXPORT (Type, Export ) \
Original file line number Diff line number Diff line change @@ -678,6 +678,12 @@ set(bmalloc_LIBRARIES
678678 ${CMAKE_DL_LIBS}
679679)
680680
681+ if (ENABLE_MALLOC_HEAP_BREAKDOWN)
682+ list (APPEND bmalloc_LIBRARIES
683+ ${MALLOC_ZONE_LIBRARIES}
684+ )
685+ endif ()
686+
681687if (ATOMICS_REQUIRE_LIBATOMIC)
682688 list (APPEND bmalloc_LIBRARIES atomic)
683689endif ()
Original file line number Diff line number Diff line change 331331#endif
332332
333333/* Enable this to put each IsoHeap and other allocation categories into their own malloc heaps, so that tools like vmmap can show how big each heap is. */
334+ #if !defined(BENABLE_MALLOC_HEAP_BREAKDOWN )
334335#define BENABLE_MALLOC_HEAP_BREAKDOWN 0
336+ #endif
335337
336338/* This is used for debugging when hacking on how bmalloc calculates its physical footprint. */
337339#define ENABLE_PHYSICAL_PAGE_MAP 0
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ DebugHeap* debugHeapCache { nullptr };
4242
4343DEFINE_STATIC_PER_PROCESS_STORAGE (DebugHeap);
4444
45- #if BOS(DARWIN)
45+ #if BENABLE_MALLOC_HEAP_BREAKDOWN
4646
4747static bool shouldUseDefaultMallocZone ()
4848{
Original file line number Diff line number Diff line change 3232#include < mutex>
3333#include < unordered_map>
3434
35- #if BOS(DARWIN)
35+ #if BENABLE_MALLOC_HEAP_BREAKDOWN
3636#include < malloc/malloc.h>
3737#endif
3838
@@ -67,7 +67,7 @@ class DebugHeap : private StaticPerProcess<DebugHeap> {
6767private:
6868 static DebugHeap* tryGetSlow ();
6969
70- #if BOS(DARWIN)
70+ #if BENABLE_MALLOC_HEAP_BREAKDOWN
7171 malloc_zone_t * m_zone;
7272#endif
7373
Original file line number Diff line number Diff line change 3333
3434#if !BUSE(LIBPAS)
3535
36- #if BOS(DARWIN)
36+ #if BENABLE_MALLOC_HEAP_BREAKDOWN
3737#include < malloc/malloc.h>
3838#endif
3939
Original file line number Diff line number Diff line change @@ -117,6 +117,9 @@ WEBKIT_OPTION_DEFINE(ENABLE_JSC_RESTRICTED_OPTIONS_BY_DEFAULT "Whether to enable
117117WEBKIT_OPTION_DEFINE (USE_FLITE "Whether to use Flite library for SpeechSynthesis" PRIVATE ${ENABLE_EXPERIMENTAL_FEATURES} )
118118WEBKIT_OPTION_DEFINE (USE_TTS_CLIENT "Whether to use TTSClient API for SpeechSynthesis" PRIVATE OFF )
119119
120+ # Debug memory heap breakdown with malloc-zone allocator
121+ WEBKIT_OPTION_DEFINE (ENABLE_MALLOC_HEAP_BREAKDOWN "Whether to enable malloc heap breakdown" PRIVATE OFF )
122+
120123WEBKIT_OPTION_CONFLICT (ENABLE_WPE_PLATFORM ENABLE_WPE_1_1_API )
121124
122125WEBKIT_OPTION_DEPEND (ENABLE_DOCUMENTATION ENABLE_INTROSPECTION )
@@ -485,5 +488,16 @@ EXPOSE_STRING_VARIABLE_TO_BUILD(WPE_WEB_PROCESS_EXTENSION_PC_MODULE)
485488set (WPEWebProcessExtension_PKGCONFIG_FILE ${CMAKE_BINARY_DIR} /${WPE_WEB_PROCESS_EXTENSION_PC_MODULE} .pc)
486489set (WPEWebProcessExtension_Uninstalled_PKGCONFIG_FILE ${CMAKE_BINARY_DIR} /${WPE_WEB_PROCESS_EXTENSION_PC_MODULE} -uninstalled.pc)
487490
491+ if (ENABLE_MALLOC_HEAP_BREAKDOWN)
492+ # Use same heap breakdown setting for bmalloc
493+ add_definitions (-DBENABLE_MALLOC_HEAP_BREAKDOWN=1 )
494+
495+ # Darwin OS has support for malloc zones without additional libraries. On non Darwin OS
496+ # targets, the library needs to be provided if heap breakdown is enabled
497+ if (NOT CMAKE_SYSTEM_NAME MATCHES "Darwin" )
498+ set (MALLOC_ZONE_LIBRARIES malloc-zone)
499+ endif ()
500+ endif ()
501+
488502include (BubblewrapSandboxChecks )
489503include (GStreamerChecks )
You can’t perform that action at this time.
0 commit comments