Free memory properly in test.
Use size functions more in chunk.
Lame safety commit.

[skip ci]