Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - finding memory leaks with librcheck or libmalloc: (6 Items)
   
finding memory leaks with librcheck or libmalloc  
Hi,

I'm trying to find some memory leak on a running program on my target.
I've seen the subject wiki3513, but when I set the following environment variable:
export LD_PRELOAD=librcheck.so.1
and run my program, I'v the error message :
# unknown symbol: pthread_setname_np
unknown symbol: __ldd_deregister_eh
unknown symbol: __ldd_register_eh
Could not resolve all symbols

How can I fix that?

Is it possible to do the same thing with the libmalloc?
With the libmalloc tool I get a dump file (using MALLOC_DUMP_LEAKS=/tmp/leak_mem), but I miss the allocation backtrace.

Maÿlis
Re: finding memory leaks with librcheck or libmalloc  
These errors indicate that you running it on QNX 6.3.0, this library can run only on 6.3.2.
For 6.3.0 use libmalloc_g.so.2 (or libmalloc.so.2 located in debug folder on target, I don't remember full path...)
Re: finding memory leaks with librcheck or libmalloc  
Re: finding memory leaks with librcheck or libmalloc  
It's /usr/lib/libmalloc_g.so, it's actually a link to
the /usr/lib/malloc_g/libmalloc.so.2


-----Original Message-----
From: Elena Laskavaia <community-noreply@qnx.com>
Reply-to: post43678@community.qnx.com
To: general-ide <post43678@community.qnx.com>
Subject: Re: finding memory leaks with librcheck or libmalloc
Date: Fri, 11 Dec 2009 12:21:45 -0500 (EST)

These errors indicate that you running it on QNX 6.3.0, this library can run only on 6.3.2.
For 6.3.0 use libmalloc_g.so.2 (or libmalloc.so.2 located in debug folder on target, I don't remember full path...)


Re: finding memory leaks with librcheck or libmalloc  
Like I've said, I tried with the debug libmalloc. I succed to have a memory leak dump file (using export 
MALLOC_DUMP_LEAKS=/logfile)

I found which pointer was not desallocated but I need to know where this allocation was made.

I've tried to connect to my target from the IDE (created a null project with the binary and launching a remote profile 
session via QCONN  in order to see the allocation backtrace), but I don't see anything in the IDE not even the 
allocation statistic. The console window is also empty.

The environment variables on my target are 
export LD_PRELOAD=/malloc_g/libmalloc.so.2
export MALLOC_CTHREAD=1
export MALLOC_TRACE=/dev/dbgmem

Did I miss something?
thanks
Re: finding memory leaks with librcheck or libmalloc  
Depends what you trying to do. If you want to import postmortem you need to 
import both files in IDE

export LD_PRELOAD=/malloc_g/libmalloc.so.2
export MALLOC_CTHREAD=1
export MALLOC_TRACE=/logfile1
export MALLOC_DUMP_LEAKS=/logfile2

transfer both logfile1 and logfile2 to target
Using Mememory Analysis import action import both files in the same session,
trace file first, than leaks.

Btw your leak log should contain allocation backtrace, can you attach it or part of it?