Store a shared_ptr to allocated strings in a local static container, so they will be garbage collected at program exit.