Minor cleanup of compact prototype

Fix warnings, fix memory leaks, change stats code to eat less memory if
it's disabled, fix 64-bit compatibility issues (modulo _memory size - tbd)