These classes are derived from the locale::facet class, which implements Reference Counting (according to documentation). Therefore, in both of your examples, the objects will be deleted.
You can add a destructor to custom_numpunct to see that it is executed.
(However, some adjustments are needed to allocate the custom_numpunct or codecvt_utf8 objects on the stack).