Copy-on-write and small-object optimizations