On 11/05/15 03:34, Patrick Palka wrote:
In gcc/cp/error.c we initialize the C++ pretty printer object twice: first during statics initialization and later in a placement-new in init_error(). This double-initialization causes a memory leak of about 7kb according to valgrind. I don't see a reason to initialize the object a second time so I elected to remove init_error().
I seem to remember there is some issue with the constructors when using static initialization that requires the placement-new. We also do the placement-new dance in the other FEs and the reason should be the same.
My preference would be to replace the static with a pointer and placement-new with proper new and delete, but see: https://gcc.gnu.org/ml/gcc-patches/2014-12/msg00910.html
If you change it here, please change it everywhere else where we use placement-new, such that all FEs are consistent on this.
Cheers, Manuel.