[ros-diffs] [sir_richard] 49756: [FREELDR]: For *every single heap allocation*, there was code to request an entire *heap statistic run*! This is ridiculous and slows heap allocations tremendously. Additionall...

sir_richard at svn.reactos.org sir_richard at svn.reactos.org
Tue Nov 23 17:29:41 UTC 2010


Author: sir_richard
Date: Tue Nov 23 17:29:40 2010
New Revision: 49756

URL: http://svn.reactos.org/svn/reactos?rev=49756&view=rev
Log:
[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).

Modified:
    trunk/reactos/boot/freeldr/freeldr/mm/mm.c

Modified: trunk/reactos/boot/freeldr/freeldr/mm/mm.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/mm/mm.c?rev=49756&r1=49755&r2=49756&view=diff
==============================================================================
--- trunk/reactos/boot/freeldr/freeldr/mm/mm.c [iso-8859-1] (original)
+++ trunk/reactos/boot/freeldr/freeldr/mm/mm.c [iso-8859-1] Tue Nov 23 17:29:40 2010
@@ -85,7 +85,6 @@
 PVOID MmHeapAlloc(ULONG MemorySize)
 {
 	PVOID Result;
-	LONG CurAlloc, TotalFree, MaxFree, NumberOfGets, NumberOfRels;
 
 	if (MemorySize > MM_PAGE_SIZE)
 	{
@@ -99,13 +98,17 @@
 	{
 		DPRINTM(DPRINT_MEMORY, "Heap allocation for %d bytes failed\n", MemorySize);
 	}
-
-	// 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);
-
+#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);
+	}
+#endif
 	return Result;
 }
 




More information about the Ros-diffs mailing list