|
From: qd <qd...@ya...> - 2005-09-08 03:35:41
|
if I have a struct like this:
struct mystruct{
char *a;
char *b;
};
and valgrind says that "b" is indirectly lost, what
does it mean? Am I leaking only "b" or am I leaking
the whole struct?
If only "b" is leaking, shouldn't it be a "directly
lost"?
If the whole struct is leaking, I'm expecting another
valgrind record saying that "mystruct" is leaking
which I didn't see in my case.
Can someone clarify under what circumstances I'll get
a "indirectly lost" record?
Thanks!
-Quan
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|
|
From: Bob R. <bo...@br...> - 2005-09-08 10:49:36
|
On Wed, Sep 07, 2005 at 08:35:33PM -0700, qd wrote:
> if I have a struct like this:
>
> struct mystruct{
> char *a;
> char *b;
> };
>
> and valgrind says that "b" is indirectly lost, what
> does it mean? Am I leaking only "b" or am I leaking
> the whole struct?
>
> If only "b" is leaking, shouldn't it be a "directly
> lost"?
> If the whole struct is leaking, I'm expecting another
> valgrind record saying that "mystruct" is leaking
> which I didn't see in my case.
>
> Can someone clarify under what circumstances I'll get
> a "indirectly lost" record?
> Thanks!
Please see this,
http://sourceforge.net/mailarchive/forum.php?thread_id=7922894&forum_id=32038
Bob Rossi
|
|
From: qd <qd...@ya...> - 2005-09-08 15:26:31
|
Thanks Bob, my valgrind record is like this:
==30386== 243 bytes in 12 blocks are indirectly lost
in loss record 59 of 109
I can understand a record like this:
==30386== 386 (143 direct, 243 indirect) bytes in 2
blocks are definitely lost in loss record 57 of 109
which shows both direct and indirect leaks.
What I don't understand is how come I got an
"indirectly lost" without a corresponding "directly
lost".
-Quan
--- Bob Rossi <bo...@br...> wrote:
> On Wed, Sep 07, 2005 at 08:35:33PM -0700, qd wrote:
> > if I have a struct like this:
> >
> > struct mystruct{
> > char *a;
> > char *b;
> > };
> >
> > and valgrind says that "b" is indirectly lost,
> what
> > does it mean? Am I leaking only "b" or am I
> leaking
> > the whole struct?
> >
> > If only "b" is leaking, shouldn't it be a
> "directly
> > lost"?
> > If the whole struct is leaking, I'm expecting
> another
> > valgrind record saying that "mystruct" is leaking
> > which I didn't see in my case.
> >
> > Can someone clarify under what circumstances I'll
> get
> > a "indirectly lost" record?
> > Thanks!
>
> Please see this,
>
>
http://sourceforge.net/mailarchive/forum.php?thread_id=7922894&forum_id=32038
>
> Bob Rossi
>
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/
|