Hello Harry;
What results do you get when using the "Compress" button that you show on the left side of the screencapture you attached?
If you cannot free used memory that way, yes you will have to work on optimizing your code.
Hope this helps,
Daniel chartier