More statistics + bug fixes

1. Fixed bug in chunk.h that caused errors in large chunks.
2. Added statistics collected by memory allocator and by agent
3. Improved reporting of statistics at client.