In Today's embedded system design architecture, in order to reduce resources consumption, hardware designers sometimes choose Scratchpad Memory instead of Cache. However, the management of the Scratchpad Memory by software is an important issue to get the best memory utilization. We discuss the related techniques on improving Scratchpad Memory usage, and propose an optimization mechanism which dynamically allocates the space in the scratchpad memory required by the application program. We also introduce a hardware assist to reduce the extra overhead needed by pure a software approach.