WebKit Bugzilla
Attachment 342237 Details for
Bug 186422
: Experiment: create lots of different malloc zones for easier accounting of memory use
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Totally hacky patch
isoheaps.patch (text/plain), 4.07 KB, created by
Simon Fraser (smfr)
on 2018-06-07 21:20:00 PDT
(
hide
)
Description:
Totally hacky patch
Filename:
MIME Type:
Creator:
Simon Fraser (smfr)
Created:
2018-06-07 21:20:00 PDT
Size:
4.07 KB
patch
obsolete
>diff --git a/Source/bmalloc/bmalloc/DebugHeap.h b/Source/bmalloc/bmalloc/DebugHeap.h >index 314b9c3d92d06cc0fc908947eccbecc912972d3b..2a43128011ad79d7e430850b58d5b02b9143140e 100644 >--- a/Source/bmalloc/bmalloc/DebugHeap.h >+++ b/Source/bmalloc/bmalloc/DebugHeap.h >@@ -34,7 +34,7 @@ > #endif > > namespace bmalloc { >- >+ > class DebugHeap { > public: > DebugHeap(std::lock_guard<Mutex>&); >diff --git a/Source/bmalloc/bmalloc/IsoConfig.h b/Source/bmalloc/bmalloc/IsoConfig.h >index e615e72a477c4aa13e0ef0dbc6546dd19aaecb08..1bdbb8adf043f26faff57e29d18f48a8ba2a19d0 100644 >--- a/Source/bmalloc/bmalloc/IsoConfig.h >+++ b/Source/bmalloc/bmalloc/IsoConfig.h >@@ -25,6 +25,8 @@ > > #pragma once > >+#define UNIQUE_ISO_HEAP_MALLOC_ZONES 1 >+ > namespace bmalloc { > > template<unsigned passedObjectSize> >diff --git a/Source/bmalloc/bmalloc/IsoHeap.h b/Source/bmalloc/bmalloc/IsoHeap.h >index 0cd3764806b75cb24cc76e4889bbc0c4dffc046e..f314ba6ee8380810b2cb82de70cb4b9b0dc34879 100644 >--- a/Source/bmalloc/bmalloc/IsoHeap.h >+++ b/Source/bmalloc/bmalloc/IsoHeap.h >@@ -28,6 +28,10 @@ > #include "IsoConfig.h" > #include "Mutex.h" > >+#if UNIQUE_ISO_HEAP_MALLOC_ZONES >+#include <malloc/malloc.h> >+#endif >+ > namespace bmalloc { > > template<typename Config> class IsoHeapImpl; >@@ -44,6 +48,8 @@ template<typename Type> > struct IsoHeap { > typedef IsoConfig<sizeof(Type)> Config; > >+ IsoHeap(const char*); >+ > void* allocate(); > void* tryAllocate(); > void deallocate(void* p); >@@ -64,6 +70,11 @@ struct IsoHeap { > unsigned m_allocatorOffsetPlusOne; > unsigned m_deallocatorOffsetPlusOne; > IsoHeapImpl<Config>* m_impl; >+ >+#if UNIQUE_ISO_HEAP_MALLOC_ZONES >+ const char* m_heapClass; >+ malloc_zone_t* m_zone; >+#endif > }; > > // Use this together with MAKE_BISO_MALLOCED_IMPL. >diff --git a/Source/bmalloc/bmalloc/IsoHeapInlines.h b/Source/bmalloc/bmalloc/IsoHeapInlines.h >index 35f90f5ef74bb15fcab831f0d7ebe67ae873a1fb..5195c312e8eb84543322efab79be872fbffc5676 100644 >--- a/Source/bmalloc/bmalloc/IsoHeapInlines.h >+++ b/Source/bmalloc/bmalloc/IsoHeapInlines.h >@@ -43,6 +43,12 @@ > > namespace bmalloc { namespace api { > >+template<typename Type> >+IsoHeap<Type>::IsoHeap(const char* heapClass) >+ : m_heapClass(heapClass) >+{ >+} >+ > template<typename Type> > void* IsoHeap<Type>::allocate() > { >@@ -89,7 +95,7 @@ auto IsoHeap<Type>::impl() -> IsoHeapImpl<Config>& > public: \ > static ::bmalloc::api::IsoHeap<isoType>& bisoHeap() \ > { \ >- static ::bmalloc::api::IsoHeap<isoType> heap; \ >+ static ::bmalloc::api::IsoHeap<isoType> heap(#isoType); \ > return heap; \ > } \ > \ >@@ -115,7 +121,7 @@ typedef int __makeBisoMallocedInlineMacroSemicolonifier > #define MAKE_BISO_MALLOCED_IMPL(isoType) \ > ::bmalloc::api::IsoHeap<isoType>& isoType::bisoHeap() \ > { \ >- static ::bmalloc::api::IsoHeap<isoType> heap; \ >+ static ::bmalloc::api::IsoHeap<isoType> heap(#isoType); \ > return heap; \ > } \ > \ >diff --git a/Source/bmalloc/bmalloc/IsoTLSInlines.h b/Source/bmalloc/bmalloc/IsoTLSInlines.h >index 20f6afeacd9d9ae97af0bf0c6dc518551c7eea09..70877333f89f9e426611076cc62bdeddc9ed4353 100644 >--- a/Source/bmalloc/bmalloc/IsoTLSInlines.h >+++ b/Source/bmalloc/bmalloc/IsoTLSInlines.h >@@ -25,6 +25,7 @@ > > #pragma once > >+#include "IsoConfig.h" > #include "IsoHeapImpl.h" > #include "IsoTLS.h" > #include "bmalloc.h" >@@ -93,7 +94,11 @@ BNO_INLINE void* IsoTLS::allocateSlow(api::IsoHeap<Type>& handle, bool abortOnFa > } > break; > } >- >+ >+#if UNIQUE_ISO_HEAP_MALLOC_ZONES >+ return malloc_zone_malloc(handle.m_zone, Config::objectSize); >+#endif >+ > auto debugMallocResult = debugMalloc(Config::objectSize); > if (debugMallocResult.usingDebugHeap) > return debugMallocResult.ptr; >@@ -179,6 +184,11 @@ void IsoTLS::ensureHeap(api::IsoHeap<Type>& handle) > handle.setAllocatorOffset(heap->allocatorOffset()); > handle.setDeallocatorOffset(heap->deallocatorOffset()); > handle.m_impl = heap; >+ >+#if UNIQUE_ISO_HEAP_MALLOC_ZONES >+ handle.m_zone = malloc_create_zone(0, 0); >+ malloc_set_zone_name(handle.m_zone, "ISOHeap zone"); >+#endif > } > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186422
:
342237
|
342911
|
342912
|
352402
|
369931
|
369938
|
369939
|
369940
|
369941
|
370089
|
370092
|
370901
|
370923
|
370927
|
370930
|
370998
|
371234
|
371238
|
386485
|
386486
|
386487
|
386488
|
386497
|
386503
|
386506
|
386507
|
386508
|
386550
|
386632