From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 59997 invoked by alias); 11 May 2015 13:04:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 59981 invoked by uid 89); 11 May 2015 13:04:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RCVD_IN_SORBS_WEB,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wg0-f41.google.com Received: from mail-wg0-f41.google.com (HELO mail-wg0-f41.google.com) (74.125.82.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 11 May 2015 13:04:01 +0000 Received: by wgin8 with SMTP id n8so127549233wgi.0 for ; Mon, 11 May 2015 06:03:58 -0700 (PDT) X-Received: by 10.180.82.97 with SMTP id h1mr19407387wiy.26.1431349438262; Mon, 11 May 2015 06:03:58 -0700 (PDT) Received: from [192.168.1.213] ([185.13.202.219]) by mx.google.com with ESMTPSA id bz11sm13256129wib.2.2015.05.11.06.03.56 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2015 06:03:57 -0700 (PDT) Message-ID: <5550A8BB.1010001@gmail.com> Date: Mon, 11 May 2015 13:04:00 -0000 From: =?UTF-8?B?TWFudWVsIEzDs3Blei1JYsOhw7Fleg==?= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Patrick Palka <"patrick@parcs.ath.cx">, gcc-patches@gcc.gnu.org CC: jason@redhat.com Subject: Re: [PATCH] Fix memory leak in C++ pretty printer References: <1431308052-31361-1-git-send-email-patrick@parcs.ath.cx> In-Reply-To: <1431308052-31361-1-git-send-email-patrick@parcs.ath.cx> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2015-05/txt/msg00916.txt.bz2 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.