public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libobjc/54432] New: Memory leak when linking libobjc with gcc
@ 2012-08-31  1:49 karlkrch at gmail dot com
  2012-08-31  2:07 ` [Bug libobjc/54432] " karlkrch at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: karlkrch at gmail dot com @ 2012-08-31  1:49 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54432

             Bug #: 54432
           Summary: Memory leak when linking libobjc with gcc
    Classification: Unclassified
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libobjc
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: karlkrch@gmail.com


Very simple test case. 

Created a main.m file with contents: 
`int main(){ return 1; }` 

Compile with gcc: 
`gcc main.m -o main -lobjc` 

Run valgrind: 
`valgrind main` 

Get memory leak: 
==27005== HEAP SUMMARY: 
==27005== in use at exit: 8,485 bytes in 133 blocks 
==27005== total heap usage: 145 allocs, 12 frees, 11,053 bytes allocated 
==27005== 
==27005== LEAK SUMMARY: 
==27005== definitely lost: 16 bytes in 1 blocks 
==27005== indirectly lost: 16 bytes in 1 blocks 
==27005== possibly lost: 0 bytes in 0 blocks 
==27005== still reachable: 8,453 bytes in 131 blocks 
==27005== suppressed: 0 bytes in 0 blocks 

If I don't link libobjc then I get no memory leaks. Not sure if this is a gcc
or valgrind bug.


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

* [Bug libobjc/54432] Memory leak when linking libobjc with gcc
  2012-08-31  1:49 [Bug libobjc/54432] New: Memory leak when linking libobjc with gcc karlkrch at gmail dot com
@ 2012-08-31  2:07 ` karlkrch at gmail dot com
  2012-08-31  2:11 ` karlkrch at gmail dot com
  2012-08-31  2:12 ` karlkrch at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: karlkrch at gmail dot com @ 2012-08-31  2:07 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54432

--- Comment #1 from Karl Kirch <karlkrch at gmail dot com> 2012-08-31 02:06:50 UTC ---
Another test case. 
Looks like I end up with lost memory for every class I define.

#include <objc/Object.h>

@interface Test : Object
{}
@end

@implementation Test
@end

int main()
{
  id t = [[Test alloc] init];
  [t free];
  return 0;
}


and Valgrind gives me
==28397== HEAP SUMMARY:
==28397==     in use at exit: 10,136 bytes in 150 blocks
==28397==   total heap usage: 169 allocs, 19 frees, 12,808 bytes allocated
==28397==
==28397== LEAK SUMMARY:
==28397==    definitely lost: 32 bytes in 2 blocks
==28397==    indirectly lost: 16 bytes in 1 blocks
==28397==      possibly lost: 0 bytes in 0 blocks
==28397==    still reachable: 10,088 bytes in 147 blocks
==28397==         suppressed: 0 bytes in 0 blocks


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

* [Bug libobjc/54432] Memory leak when linking libobjc with gcc
  2012-08-31  1:49 [Bug libobjc/54432] New: Memory leak when linking libobjc with gcc karlkrch at gmail dot com
  2012-08-31  2:07 ` [Bug libobjc/54432] " karlkrch at gmail dot com
@ 2012-08-31  2:11 ` karlkrch at gmail dot com
  2012-08-31  2:12 ` karlkrch at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: karlkrch at gmail dot com @ 2012-08-31  2:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54432

--- Comment #2 from Karl Kirch <karlkrch at gmail dot com> 2012-08-31 02:10:38 UTC ---
GCC info 
gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --disable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)


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

* [Bug libobjc/54432] Memory leak when linking libobjc with gcc
  2012-08-31  1:49 [Bug libobjc/54432] New: Memory leak when linking libobjc with gcc karlkrch at gmail dot com
  2012-08-31  2:07 ` [Bug libobjc/54432] " karlkrch at gmail dot com
  2012-08-31  2:11 ` karlkrch at gmail dot com
@ 2012-08-31  2:12 ` karlkrch at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: karlkrch at gmail dot com @ 2012-08-31  2:12 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54432

--- Comment #3 from Karl Kirch <karlkrch at gmail dot com> 2012-08-31 02:11:48 UTC ---
GCC info 
gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
--disable-dssi --disable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)


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

end of thread, other threads:[~2012-08-31  2:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-31  1:49 [Bug libobjc/54432] New: Memory leak when linking libobjc with gcc karlkrch at gmail dot com
2012-08-31  2:07 ` [Bug libobjc/54432] " karlkrch at gmail dot com
2012-08-31  2:11 ` karlkrch at gmail dot com
2012-08-31  2:12 ` karlkrch at gmail dot com

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