about summary refs log tree commit diff
path: root/malloc/memusage.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc/memusage.c')
-rw-r--r--malloc/memusage.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/malloc/memusage.c b/malloc/memusage.c
index 6296d99230..34e33475e3 100644
--- a/malloc/memusage.c
+++ b/malloc/memusage.c
@@ -117,7 +117,11 @@ update_data (struct header *result, size_t len, size_t old_len)
     peak_heap = current_heap;
 
   /* Compute current stack usage and compare it with the maximum value.  */
+#ifdef STACK_GROWS_UPWARD
+  current_stack = GETSP () - start_sp;
+#else
   current_stack = start_sp - GETSP ();
+#endif
   if (current_stack > peak_stack)
     peak_stack = current_stack;