Memory leaking..

P

Philip Potter

Jack said:
Yes, he can. As far as the C language is concerned, and that's the
only thing that counts here, free() was properly called on a pointer
returned from malloc(). Since the free() function cannot fail if
called correctly, as it is in this case, the memory was freed.

Neither Ian nor I have to know much about valgrind, the Magna Carta,
or a Comcast commercial featuring the Slowskys, to state that if they
say this memory was not freed, the are wrong.

The memory was freed in the only context that matters in this group.

But it didn't say it wasn't freed, it said it was "still reachable".
That means "No memory leak" in valgrind terms.
 
G

Guest

Yes, he can. As far as the C language is concerned, ...

May I suggest that you think this over? I maintain that my statement
above is true in every context, be it the C language or anything else.
 
R

Richard Heathfield

Jack Klein said:
Yes, he can.

No, he can't.
As far as the C language is concerned, and that's the
only thing that counts here, free() was properly called on a pointer
returned from malloc(). Since the free() function cannot fail if
called correctly, as it is in this case, the memory was freed.
Indeed.

Neither Ian nor I have to know much about valgrind, the Magna Carta,
or a Comcast commercial featuring the Slowskys, to state that if they
say this memory was not freed, the are wrong.

So what you're really saying is that, if you *do* know what something
means, you can know that it is wrong.
The memory was freed in the only context that matters in this group.

Nobody disputes that (AFAIK!).
 
C

Chris Dollin

May I suggest that you think this over? I maintain that my statement
above is true in every context, be it the C language or anything else.

You can know that what something /says/ is false, but have independent
evidence that the said thing is [taken to be] true. From this you may
conclude that it doesn't mean what it says, and so you've no idea what
it means. But you do know that what it says is wrong.
 
T

Tor Rustad

Richard said:
Jack Klein said:
[...]
The memory was freed in the only context that matters in this group.

Nobody disputes that (AFAIK!).

Why, isn't static storage duration of string literals relevant?

Methinks valgrind reported this:

char *str="Five pineapples";
 
J

J. J. Farrell

Jack said:
Yes, he can. As far as the C language is concerned, and that's the
only thing that counts here, free() was properly called on a pointer
returned from malloc(). Since the free() function cannot fail if
called correctly, as it is in this case, the memory was freed.

Neither Ian nor I have to know much about valgrind, the Magna Carta,
or a Comcast commercial featuring the Slowskys, to state that if they
say this memory was not freed, the are wrong.

Something of a straw man, Jack. Whoever said that the memory was not
freed? Valgrind reportedly said "16 byts (sic) in 1 block still
reachable". Does that have anything to do with memory being freed? I
don't know. I have no idea what it means. I don't know whether or not it
is wrong, since I don't know what it is trying to say. Ian appears to be
in much the same position as me, since when asked what it means he said
"I've no idea, never having used valgrind". However, he went on to say
that the message was wrong. Since he does not know what the message
means he cannot know it is wrong, and is wrong to say that it is wrong.
For all that you, I, or Ian know, it might be Valgrind's obscure way of
saying "all memory allocated by malloc() has been correctly freed".
The memory was freed in the only context that matters in this group.

The OP's question may be off-topic, but that doesn't impinge on whether
or not the message was wrong; it impinges on our ability to say whether
or not the message was wrong.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,276
Latest member
Sawatmakal

Latest Threads

Top