AppleScript Studio and memory allocation

Two-part question

My understanding is that the memory that’s allocated by an AppleScript is released after the script has ended. I however, wrote an application that keeps running. It uses the on idle handler to watch specific folder and perform actions when a file is placed in that folder. After a week of running the system really starts to bog down. A memory leak I’m sure. My solution is to have that computer restart it self once a week. Might there be a better approach?

Can you use X-Codes performance tools to analyze and optimize AppleScript Studio applications?