Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Benedikt Penner <benedikt.penner@gmx.de>
Cc: "gdb\@sourceware.org" <gdb@sourceware.org>
Subject: Re: print expr or eval expr and memory usage
Date: Tue, 15 Feb 2011 20:06:00 -0000	[thread overview]
Message-ID: <m37hd183m4.fsf@fleche.redhat.com> (raw)
In-Reply-To: <10EAA72F8FC8D044A6AF5F1ABE370497012611390691@exchange2007.lupuz.dyndns.org>	(Benedikt Penner's message of "Tue, 15 Feb 2011 20:57:04 +0100")

>>>>> "Benedikt" == Benedikt Penner <benedikt.penner@gmx.de> writes:

Benedikt> If i use "print expr" to execute a non void function which for
Benedikt> example returns a char *, what happens with the allocated
Benedikt> memory? Do i have to free it using gdb?

gdb doesn't automatically free anything.  So, if your function mallocs
some memory and expects the caller to free it, and you care about this,
then you must free it by calling free from gdb.

Tom


      reply	other threads:[~2011-02-15 20:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-15 19:58 Benedikt Penner
2011-02-15 20:06 ` Tom Tromey [this message]

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=m37hd183m4.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=benedikt.penner@gmx.de \
    --cc=gdb@sourceware.org \
    /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