Memory Management

Some references are not closed during parsing process.

With large project, this could lead to "Not enough memory" error.