fix a memory usage issue
Merge pull request #279 from haiwen/bugfix-memory-usage

fix a memory usage issue