public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Possible leaks observed in GCC.
@ 2020-12-09 12:44 Tomar, Sourabh Singh
  2020-12-09 12:53 ` Jonathan Wakely
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Tomar, Sourabh Singh @ 2020-12-09 12:44 UTC (permalink / raw)
  To: gcc
  Cc: George, Jini Susan, Sharma, Alok Kumar, Kumar N, Bhuvanendra,
	Kumar, Venkataramanan

Hi Folks,

I observed some leaks using valgrind while compiling a sample program using GCC.

Could anyone aware of these details provide any insights to these leaks ?

Command line Details:
$ valgrind gcc main.c -g
==32090== Memcheck, a memory error detector
==32090== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==32090== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==32090== Command: gcc main.c -g
==32090==
==32090==
==32090== HEAP SUMMARY:
==32090==     in use at exit: 171,779 bytes in 101 blocks
==32090==   total heap usage: 394 allocs, 293 frees, 222,596 bytes allocated
==32090==
==32090== LEAK SUMMARY:
==32090==    definitely lost: 6,019 bytes in 36 blocks
==32090==    indirectly lost: 82 bytes in 5 blocks
==32090==      possibly lost: 0 bytes in 0 blocks
==32090==    still reachable: 165,678 bytes in 60 blocks
==32090==         suppressed: 0 bytes in 0 blocks
==32090== Rerun with --leak-check=full to see details of leaked memory
==32090==
==32090== For counts of detected and suppressed errors, rerun with: -v
==32090== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)

Cheers,
Sourabh.

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

* Re: Possible leaks observed in GCC.
  2020-12-09 12:44 Possible leaks observed in GCC Tomar, Sourabh Singh
@ 2020-12-09 12:53 ` Jonathan Wakely
  2020-12-09 12:55   ` Jonathan Wakely
  2020-12-09 12:55 ` Paul Floyd
  2020-12-09 13:09 ` Paul Floyd
  2 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2020-12-09 12:53 UTC (permalink / raw)
  To: Tomar, Sourabh Singh
  Cc: gcc, George, Jini Susan, Sharma, Alok Kumar, Kumar N, Bhuvanendra

On Wed, 9 Dec 2020 at 12:45, Tomar, Sourabh Singh via Gcc
<gcc@gcc.gnu.org> wrote:
>
> Hi Folks,
>
> I observed some leaks using valgrind while compiling a sample program using GCC.

This seems more appropriate for gcc-help@gcc.gnu.org instead.

> Could anyone aware of these details provide any insights to these leaks ?

You've provided no information that can tell us anything for sure, but
these are probably leaks caused by your code. You can use valgrind to
find them.

Valgrind tells you what to do:

> ==32090== Rerun with --leak-check=full to see details of leaked memory

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

* Re: Possible leaks observed in GCC.
  2020-12-09 12:44 Possible leaks observed in GCC Tomar, Sourabh Singh
  2020-12-09 12:53 ` Jonathan Wakely
@ 2020-12-09 12:55 ` Paul Floyd
  2020-12-09 13:09 ` Paul Floyd
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Floyd @ 2020-12-09 12:55 UTC (permalink / raw)
  To: gcc


On 12/9/20 1:44 PM, Tomar, Sourabh Singh via Gcc wrote:
> Hi Folks,
>
> I observed some leaks using valgrind while compiling a sample program using GCC.
>
> Could anyone aware of these details provide any insights to these leaks ?
>
> ==32090== Rerun with --leak-check=full to see details of leaked memory


Hi

For a start, do what Valgrind told you to do (the line above that I kept).

I would also recommend --show-leak-kinds=all and -s.

A+

Paul


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

* Re: Possible leaks observed in GCC.
  2020-12-09 12:53 ` Jonathan Wakely
@ 2020-12-09 12:55   ` Jonathan Wakely
  2020-12-09 13:00     ` Jakub Jelinek
  0 siblings, 1 reply; 6+ messages in thread
From: Jonathan Wakely @ 2020-12-09 12:55 UTC (permalink / raw)
  To: Tomar, Sourabh Singh
  Cc: gcc, George, Jini Susan, Sharma, Alok Kumar, Kumar N, Bhuvanendra

On Wed, 9 Dec 2020 at 12:53, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Wed, 9 Dec 2020 at 12:45, Tomar, Sourabh Singh via Gcc
> <gcc@gcc.gnu.org> wrote:
> >
> > Hi Folks,
> >
> > I observed some leaks using valgrind while compiling a sample program using GCC.
>
> This seems more appropriate for gcc-help@gcc.gnu.org instead.
>
> > Could anyone aware of these details provide any insights to these leaks ?
>
> You've provided no information that can tell us anything for sure, but
> these are probably leaks caused by your code. You can use valgrind to
> find them.

Oh sorry, I missed that you're running gcc itself under valgrind.
Those are probably intentional, because GCC uses garbage collection
for some of its allocations, and knows that it's not going to be a
long-running process, so it will exit fairly soon and all memory will
be freed on exit.

Using --leak-check=full would still give you more information.

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

* Re: Possible leaks observed in GCC.
  2020-12-09 12:55   ` Jonathan Wakely
@ 2020-12-09 13:00     ` Jakub Jelinek
  0 siblings, 0 replies; 6+ messages in thread
From: Jakub Jelinek @ 2020-12-09 13:00 UTC (permalink / raw)
  To: Jonathan Wakely
  Cc: Tomar, Sourabh Singh, George, Jini Susan, gcc, Sharma,
	Alok Kumar, Kumar N, Bhuvanendra

On Wed, Dec 09, 2020 at 12:55:40PM +0000, Jonathan Wakely via Gcc wrote:
> > > I observed some leaks using valgrind while compiling a sample program using GCC.
> >
> > This seems more appropriate for gcc-help@gcc.gnu.org instead.
> >
> > > Could anyone aware of these details provide any insights to these leaks ?
> >
> > You've provided no information that can tell us anything for sure, but
> > these are probably leaks caused by your code. You can use valgrind to
> > find them.
> 
> Oh sorry, I missed that you're running gcc itself under valgrind.
> Those are probably intentional, because GCC uses garbage collection
> for some of its allocations, and knows that it's not going to be a
> long-running process, so it will exit fairly soon and all memory will
> be freed on exit.
> 
> Using --leak-check=full would still give you more information.

Well, primarily it was run on the gcc driver rather than the actual
compiler, the only leaks in the driver would be somewhere in the option
handling and would be extremely low priority.  Leaks in the compiler are
much more interesting.
And second, without information which exact gcc version it is, there is
nothing that can be done about it anyway.

	Jakub


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

* Re: Possible leaks observed in GCC.
  2020-12-09 12:44 Possible leaks observed in GCC Tomar, Sourabh Singh
  2020-12-09 12:53 ` Jonathan Wakely
  2020-12-09 12:55 ` Paul Floyd
@ 2020-12-09 13:09 ` Paul Floyd
  2 siblings, 0 replies; 6+ messages in thread
From: Paul Floyd @ 2020-12-09 13:09 UTC (permalink / raw)
  To: gcc


On 12/9/20 1:44 PM, Tomar, Sourabh Singh via Gcc wrote:
> Hi Folks,
>
> I observed some leaks using valgrind while compiling a sample program using GCC.
>
>
> ==32090== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info

Also 3.13 is rather old. 3.16.1 is the current release - not that leak 
detection is exactly bleeding edge.


A+

Paul


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

end of thread, other threads:[~2020-12-09 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-09 12:44 Possible leaks observed in GCC Tomar, Sourabh Singh
2020-12-09 12:53 ` Jonathan Wakely
2020-12-09 12:55   ` Jonathan Wakely
2020-12-09 13:00     ` Jakub Jelinek
2020-12-09 12:55 ` Paul Floyd
2020-12-09 13:09 ` Paul Floyd

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).