Use traditional "shrink-to-fit" idiom

This restores build with libstd++ debug mode (GCC 4.6).
Merge pull request #71 from bska/fix-shrink-to-fit

Use traditional "shrink-to-fit" idiom