public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jonathan Wakely <jwakely.gcc@gmail.com>
To: Florian Weimer <fw@deneb.enyo.de>
Cc: Nikolaus Dunn <nikdunn1979@gmail.com>, gcc-help <gcc-help@gcc.gnu.org>
Subject: Re: Optimization question
Date: Wed, 28 Sep 2016 10:13:00 -0000	[thread overview]
Message-ID: <CAH6eHdSzLoW5+kXeV1TdoK1SOCEmnw9uqwyMLr+cBpCRpxs99g@mail.gmail.com> (raw)
In-Reply-To: <87zimtxkg6.fsf@mid.deneb.enyo.de>

On 27 September 2016 at 19:32, Florian Weimer wrote:
> * Nikolaus Dunn:
>
>> std::ostringstream however does not call my new OR delete with no
>> optimization. With -O2, it calls only my delete.
>>
>> If I do not attempt to wrap malloc and free, I get the same
>> result. std::vector calls my new and delete, ostringstream calls
>> neither.
>>
>> The command line I used to compile it is:
>> g++ -g -O2 --std=c++14 -Wl,-wrap,malloc -Wl,-wrap,free Test.c -o test.exe
>
> “-Wl,-wrap,malloc -Wl,-wrap,free” is only effective for newly-compiled
> code.  Your example probably uses some template instantiations which
> are supplied by libstdc++, and these will keep calling the unwrapped
> malloc/free implementations.

Right, std::stringstream doesn't allocate any memory itself, but
std::string does, and that is instantiated in the libstdc++.so
library.

> I don't know if there are mechanisms on mingw which are comparable to
> ELF symbol interposition.

  reply	other threads:[~2016-09-28 10:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <c8204c33-7085-5dde-96f3-92d7745a0018@gmail.com>
2016-09-27 15:20 ` Florian Weimer
2016-09-27 17:10   ` Jonathan Wakely
2016-09-27 17:39     ` Nikolaus Dunn
2016-09-27 17:49       ` Jonathan Wakely
2016-09-27 18:32       ` Florian Weimer
2016-09-28 10:13         ` Jonathan Wakely [this message]
2000-01-07 11:39 optimization question Igor Schein
2000-04-01  0:00 ` Igor Schein

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAH6eHdSzLoW5+kXeV1TdoK1SOCEmnw9uqwyMLr+cBpCRpxs99g@mail.gmail.com \
    --to=jwakely.gcc@gmail.com \
    --cc=fw@deneb.enyo.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=nikdunn1979@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).