From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1508 invoked by alias); 27 Sep 2016 17:10:17 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 1461 invoked by uid 89); 27 Sep 2016 17:10:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:772, HX-HELO:sk:mail-yb, H*f:sk:87zimt5, H*i:sk:87zimt5 X-HELO: mail-yb0-f175.google.com Received: from mail-yb0-f175.google.com (HELO mail-yb0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 27 Sep 2016 17:10:15 +0000 Received: by mail-yb0-f175.google.com with SMTP id 2so7370254ybv.0 for ; Tue, 27 Sep 2016 10:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=DquNpbYBehE3gvp+cyOmFF3zxmYetoqwXwdY1F7lfac=; b=jgxEkrOYYvEa1lLjh81AzmHD1tZo0GqWfv0ozML4coXAnwRVYO2J1zmdWKSbWSk6BA SDTUcqXDBaQAbjtVCli3h+TLagFEazsDGBrp8rSDxUAP1QPbxUq1UWhsTv86JiJn6m1V p+bBOivI/ssw3N8xuVWlY2yXuiiDvqicdHOTl1nBkTkGeaYOw9UrgrUctGv1QKyA63bc hmjyS3E/PrjBmztqzDqoIBFtXsQiyuf4fgBmhHc9ajK2maHqfLty34QDjnOQPY6zlX/t fuCZn47xeuzz22Vw77O1ZXK2N9lp+up9Mrtqf/s6brITfJWLuKFvJHvSYkR2BWPgiQmy wE2w== X-Gm-Message-State: AA6/9RkyOOE8amptf6X+EPk03nsFSfR8ZxTNdFrGCsZqFTIyabOzzlFbrMETaDPR98FYZQE25qeGnN4enB9Bnw== X-Received: by 10.37.98.205 with SMTP id w196mr13734101ybb.121.1474996214177; Tue, 27 Sep 2016 10:10:14 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.252.34 with HTTP; Tue, 27 Sep 2016 10:10:13 -0700 (PDT) In-Reply-To: <87zimt5pza.fsf@mid.deneb.enyo.de> References: <87zimt5pza.fsf@mid.deneb.enyo.de> From: Jonathan Wakely Date: Tue, 27 Sep 2016 17:10:00 -0000 Message-ID: Subject: Re: Optimization question To: Nikolaus Dunn , gcc-help Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg00106.txt.bz2 * Nikolaus Dunn: > I've run into an issue where turning on compiler optimization using > -O1 or higher causes an issue in my program. Specifically, I am > replacing the new and delete operators globally to perform some real > time allocation tracking. When I compile with -O1 or -O2, my > implementation of new is not being called by STL classes, via the > std::allocator. My version of delete IS being called. That doesn't make much sense, because std::allocator doesn't use new or delete for objects of type T, so neither should be called. Instead std::allocator allocates untyped memory (e.g. via malloc) and then constructs objects into it with placement new-expressions. What do you replacement new and delete operators look like?