From e79eaea9b3aad8d87f2c6cf47a1d83a1b2d168d7 Mon Sep 17 00:00:00 2001 From: Sir Richard Date: Tue, 23 Nov 2010 17:29:40 +0000 Subject: [PATCH] [FREELDR]: For *every single heap allocation*, there was code to request an entire *heap statistic run*! This is ridiculous and slows heap allocations tremendously. Additionally, it also assumes bstats was linked in, which it might not be if the flag wasn't set in bheap.c. Only enable this code if a special MM_DBG define is set. [FREELDR]: Done originally for ARM, but I think x86 will appreciate the benefit too (and x86 can now go ahead and disable all those ridiculous debug settings that are turned on by default in bheap.c). svn path=/trunk/; revision=49756 --- reactos/boot/freeldr/freeldr/mm/mm.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/mm/mm.c b/reactos/boot/freeldr/freeldr/mm/mm.c index f4a4c69b095..0066cb98d15 100644 --- a/reactos/boot/freeldr/freeldr/mm/mm.c +++ b/reactos/boot/freeldr/freeldr/mm/mm.c @@ -85,7 +85,6 @@ PVOID MmAllocateMemoryWithType(ULONG MemorySize, TYPE_OF_MEMORY MemoryType) PVOID MmHeapAlloc(ULONG MemorySize) { PVOID Result; - LONG CurAlloc, TotalFree, MaxFree, NumberOfGets, NumberOfRels; if (MemorySize > MM_PAGE_SIZE) { @@ -99,13 +98,17 @@ PVOID MmHeapAlloc(ULONG MemorySize) { DPRINTM(DPRINT_MEMORY, "Heap allocation for %d bytes failed\n", MemorySize); } +#if MM_DBG + { + LONG CurAlloc, TotalFree, MaxFree, NumberOfGets, NumberOfRels; - // Gather some stats - bstats(&CurAlloc, &TotalFree, &MaxFree, &NumberOfGets, &NumberOfRels); - - DPRINTM(DPRINT_MEMORY, "Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n", - CurAlloc, TotalFree, NumberOfGets, NumberOfRels); + // Gather some stats + bstats(&CurAlloc, &TotalFree, &MaxFree, &NumberOfGets, &NumberOfRels); + DPRINTM(DPRINT_MEMORY, "Current alloced %d bytes, free %d bytes, allocs %d, frees %d\n", + CurAlloc, TotalFree, NumberOfGets, NumberOfRels); + } +#endif return Result; }