Lesson 05: Heap and Stack Size

Stack is used for static memory allocarion and Heap for dynamic memory allocation, both stored in the system's RAM.

  • Local variables, function parameters, and function-related information are stored onto the Stack memory area;
  • The dynamic memory requirements are stored onto Heap memory area.

In the PSoC Creator, the default Stack Size is 2K Bytes (0x0800); and the Heap Size is 128 Bytes (0x80).  If you are using dynamic memory allocation, then you may need to Increase the heap size, and if you are using a lot of local variables, you must increase the Stack size.

On the Workspace Explorer panel, double-click on Design Wide Resources (.cydwr). Then in the .cydwr view, select  System tab, you can change stack and heap size in the Configuration node.

12 DWR System Heap Stack s