fix memorySize bugs and cleanup
patch by Carl Yeksigian and jbellis for CASSANDRA-5564