Parcourir la source

LibJS: Put some more Heap debug logging behind HEAP_DEBUG

Andreas Kling il y a 5 ans
Parent
commit
1dd71bd68f
1 fichiers modifiés avec 6 ajouts et 2 suppressions
  1. 6 2
      Libraries/LibJS/Heap/Heap.cpp

+ 6 - 2
Libraries/LibJS/Heap/Heap.cpp

@@ -35,9 +35,9 @@
 #include <stdio.h>
 #include <stdio.h>
 
 
 #ifdef __serenity__
 #ifdef __serenity__
-#include <serenity.h>
+#    include <serenity.h>
 #elif __linux__
 #elif __linux__
-#include <pthread.h>
+#    include <pthread.h>
 #endif
 #endif
 
 
 #define HEAP_DEBUG
 #define HEAP_DEBUG
@@ -229,13 +229,17 @@ void Heap::sweep_dead_cells()
     }
     }
 
 
     for (auto* block : empty_blocks) {
     for (auto* block : empty_blocks) {
+#ifdef HEAP_DEBUG
         dbg() << " - Reclaim HeapBlock @ " << block << ": cell_size=" << block->cell_size();
         dbg() << " - Reclaim HeapBlock @ " << block << ": cell_size=" << block->cell_size();
+#endif
         m_blocks.remove_first_matching([block](auto& entry) { return entry == block; });
         m_blocks.remove_first_matching([block](auto& entry) { return entry == block; });
     }
     }
 
 
+#ifdef HEAP_DEBUG
     for (auto& block : m_blocks) {
     for (auto& block : m_blocks) {
         dbg() << " > Live HeapBlock @ " << block << ": cell_size=" << block->cell_size();
         dbg() << " > Live HeapBlock @ " << block << ": cell_size=" << block->cell_size();
     }
     }
+#endif
 }
 }
 
 
 void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl)
 void Heap::did_create_handle(Badge<HandleImpl>, HandleImpl& impl)