How to change scene /TestCanvas

When I am developing a jMonkey Engineer project as the example of the TestCanvas.java, I have encountered a problem. Even if I have exected the project with the stop mandate: app.stop(), but actually the project still occupied 400MB memory, so when I swiched to another scene by changing the appClass, the memory often encountered an overrun problem :java heap space. I really wonder how the problem can be solved, and any suggestions or answers will be welcomed. I am waiting online for your solutions!