A stack curiosity

1 post / 0 new
OldFart
OldFart's picture
Offline
Last seen: 9 hours 29 min ago
Joined: 2010-11-30 14:09
A stack curiosity

Hi,

When executing a program in DEBUG-mode, I get a rather detailed list of events. One of those details concerns stack usage:

  1. Stack size as defined in the icon: 32768
  2.  
  3. FLOW : - main entered
  4. FLOW : -- Alloc_ExecParam entered
  5. FLOW : -- Alloc_ExecParam vacated
  6. FLOW : -- Fill_DeadBeef entered
  7. STACK: * Starts at [ 5180A004 ]
  8. STACK: * Ends at [ 51811FFC ]
  9. STACK: * Position at [ 51811690 ]
  10. STACK: * Available [ 0000768C ] = [ 30348 ]
  11. FLOW : -- Fill_DeadBeef vacated
  12. .
  13. .
  14. .
  15. FLOW : -- Read_DeadBeef entered
  16. STACK: * [ 32760 ] bytes allocated
  17. STACK: * [ 32760 ] bytes used = [ 100% ]
  18. FLOW : -- Read_DeadBeef vacated
  19. FLOW : -- Free_ExecParam entered
  20. FLOW : -- Free_ExecParam vacated
  21. FLOW : - main vacated

It looks as if stack is on the small side. However

  1. Stack size increased to 44444
  2.  
  3. FLOW : - main entered
  4. FLOW : -- Alloc_ExecParam entered
  5. FLOW : -- Alloc_ExecParam vacated
  6. FLOW : -- Fill_DeadBeef entered
  7. STACK: * Starts at [ 4E9C9004 ]
  8. STACK: * Ends at [ 4E9D3FFC ]
  9. STACK: * Position at [ 4E9D3690 ]
  10. STACK: * Available [ 0000A68C ] = [ 42636 ]
  11. FLOW : -- Fill_DeadBeef vacated
  12. .
  13. .
  14. .
  15. FLOW : -- Read_DeadBeef entered
  16. STACK: * [ 45048 ] bytes allocated
  17. STACK: * [ 13532 ] bytes used = [ 30% ]
  18. FLOW : -- Read_DeadBeef vacated
  19. FLOW : -- Free_ExecParam entered
  20. FLOW : -- Free_ExecParam vacated
  21. FLOW : - main vacated

Instead of 100% usage when 32768 bytes are allocated, usage drops to a mere 30% when 44444 bytes are provided. What is the reasoning behind this? Just curious, you know...

OldFart