memory leaks

memory leaks

After debugging a lot i find out the problems with mdb and way easy dbx mem leak cheks. I am writing here steps to find out leaks in mdb Vs dbx . Also current mdb has bug that you have to set sysbp _exit before starting and that gives you pain if you have big appliation to debug(specially threded one).

for mdb :-
[root@o4test45 ]$export LD_PRELOAD=libumem.so.1
[root@o4test45 ]$export UMEM_LOGGING=transaction
[root@o4test45 ]$export UMEM_DEBUG=default

mdb /path/application
> ::sysbp _exit
> run
mdb: failed to dereference symbol: unknown symbol name
> ::run
=======>>> FDP starting [version: 0.0.3 (2008Mar31 08:37)]
mdb: fork1 detected: follow (p)arent or (c)hild? c
mdb: target forked child process 16732 (debugger following child)

mdb: stop on SIGABRT
mdb: target stopped at:
libc.so.1`_lwp_kill+7: jae +0xe
mdb: You’ve got symbols!
Loading modules: [ ld.so.1 libumem.so.1 libc.so.1 ]
>
> ::load libumem
> ::findleaks
BYTES LEAKED VMEM_SEG CALLER
4096 1 bfd58000 MMAP
————————————————————————
Total 1 oversized leak, 4096 bytes

CACHE LEAKED BUFCTL CALLER
———————————————————————-
Total 0 buffers, 0 bytes
>

For DBX :-

export LD_AUDIT=/opt/SUNWspro/lib/rtcaudit.so before starting the process

root@o4test45 ]$export LD_AUDIT=rtcaudit.so
[root@o4test45 ]$export LD_LIBRARY_PATH=/opt/SUNWspro/lib/
[root@o4test45 ]$export LD_LIBRARY_PATH_64=/opt/SUNWspro/lib/amd64/
[root@o4test45 ]$./bin/dbx
For information about new features see `help changes’
To remove this message, put `dbxenv suppress_startup_message 7.6′ in your .dbxrc
(dbx) dbxenv mt_sync_tracking off
(dbx) attach 12279
…. …. …
… …. ….

(dbx) dbxenv rtc_auto_continue on
(dbx) dbxenv rtc_error_log_file_name /tmp/dbx.errlog.101
(dbx) dbxenv rtc_error_stack on
(dbx) check -all
access checking – ON
memuse checking – ON
RTC: Enabling Error Checking…
RTC: Running program…
(dbx) cont
(dbx) showleaks -m 8 -v

Is it not tooo easy then mdb ?

Advertisements
This entry was posted in Solaris/Linux and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s