On Wed, 19 Nov 2014, David Malcolm wrote: > There's no clean way to release them: retrofitting logic to decide if > we're dealing with a string literal vs a dynamically-allocated buffer > (and if something else is pointing to said buffer) is messy and > error-prone; they are also unconnected to the GC.
This is not an objection to your patch, but the obvious approach would seem to me to be to ensure that anything that might be allocated or might be a string constant (or maybe a string from argv in some cases?) is always allocated - use xstrdup rather than putting a string constant there directly. Once such pointers are always allocated, they can safely be freed. -- Joseph S. Myers jos...@codesourcery.com