diff --git a/includes/Rts.h b/includes/Rts.h
index 96dc6a5c308e0c87b247f9e9066f35dfb8aef30a..aca6c496052a85de6727dbc60a81be148675e326 100644
--- a/includes/Rts.h
+++ b/includes/Rts.h
@@ -250,7 +250,7 @@ void getWin32ProgArgv(int *argc, wchar_t **argv[]);
 void setWin32ProgArgv(int argc, wchar_t *argv[]);
 #endif
 
-void stackOverflow(void);
+void stackOverflow(StgTSO* tso);
 
 void stg_exit(int n) GNU_ATTRIBUTE(__noreturn__);
 
diff --git a/rts/RtsUtils.c b/rts/RtsUtils.c
index b06b6af962bd493a5e8d539263ca8908efd521ec..185f1e8bdd1fc9520d426096ac8ecd7580fe3973 100644
--- a/rts/RtsUtils.c
+++ b/rts/RtsUtils.c
@@ -114,12 +114,12 @@ stgFree(void* p)
    -------------------------------------------------------------------------- */
 
 void
-stackOverflow(void)
+stackOverflow(StgTSO* tso)
 {
-  StackOverflowHook(RtsFlags.GcFlags.maxStkSize * sizeof(W_));
+    StackOverflowHook(tso->tot_stack_size * sizeof(W_));
 
 #if defined(TICKY_TICKY)
-  if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo();
+    if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo();
 #endif
 }