Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* print expr or eval expr and memory usage
@ 2011-02-15 19:58 Benedikt Penner
  2011-02-15 20:06 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Benedikt Penner @ 2011-02-15 19:58 UTC (permalink / raw)
  To: gdb

Hi at all,
i have a little question to you.
If i use "print expr" to execute a non void function which for example returns a char *, what happens with the allocated memory? Do i have to free it using gdb?

Thanks a lot!


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: print expr or eval expr and memory usage
  2011-02-15 19:58 print expr or eval expr and memory usage Benedikt Penner
@ 2011-02-15 20:06 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2011-02-15 20:06 UTC (permalink / raw)
  To: Benedikt Penner; +Cc: gdb

>>>>> "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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-02-15 20:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-15 19:58 print expr or eval expr and memory usage Benedikt Penner
2011-02-15 20:06 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox