Fix max memory counter.
Merge pull request #3 from nouiz/GSoC2014_part2

Fix max memory counter.