[dtrace-discuss] Memory leak scripts

Sanjeev Bagewadi Sanjeev.Bagewadi at Sun.COM
Wed Jul 2 04:29:03 PDT 2008


Fletcher,

Mark Durney hit similar problem and while I was working with him and 
talking to
my colleague he pointed out that we could use "function:offset" notation 
when we
are using pid-provider.

So, I have modified the script to enable the first instruction of malloc.

Attached is the script. Please try it out and let me know if it works.
If it does I shall update my blog to reflect it.

NOTE : If there more functions which fail (for :entry) please replace 
"entry" with 0.

Thanks and regards,
Sanjeev.

Sanjeev Bagewadi wrote:
> Fletcher,
>
> You could attach mdb to the running process and disassemble the routine 
> in question :
> -- snip --
> # mdb -p <pid>
>  > malloc::dis
> libc.so.1`malloc:               pushl  %ebp
> libc.so.1`malloc+1:             movl   %esp,%ebp
> libc.so.1`malloc+3:             pushl  %ebx
> libc.so.1`malloc+4:             pushl  %esi
> libc.so.1`malloc+5:             pushl  %edi
> libc.so.1`malloc+6:             call   +0x5     <libc.so.1`malloc+0xb>
> libc.so.1`malloc+0xb:           popl   %ebx
> libc.so.1`malloc+0xc:           addl   $0x88fe1,%ebx
> -- snip --
>
> So, in my case notice that the first instruction is "pushl".
>
> Thanks and regards,
> Sanjeev.
> Fletcher Cocquyt wrote:
>   
>> Can you please provide a reference for disassembling malloc on Solaris 10?
>> I am also pursuing the previous suggestion of a Python provider - this one
>> seems to be against Python 2.5:
>> http://blogs.sun.com/binujp/resource/pydtrace/diffs
>>
>> Thanks,
>> Fletcher
>>
>> On 7/1/08 9:48 PM, "Sanjeev Bagewadi" <Sanjeev.Bagewadi at Sun.COM> wrote:
>>
>>   
>>     
>>> Hello Fletcher,
>>>
>>>  From the error looks like dtrace is not able recognize it as probe.
>>> DTrace needs a signature for the function to be detected as probe.
>>> Probably this is missing in case of malloc.
>>>
>>> Just to double check this you could disassemble malloc and check if we
>>> have a "push' instruction at the beginning.
>>>
>>> Thanks and regards,
>>> Sanjeev.
>>>
>>> Fletcher Cocquyt wrote:
>>>     
>>>       
>>>> Hola, I am trying to isolate the memory leak I suspect in a mailman
>>>> installation ­ I found:
>>>> http://blogs.sun.com/sanjeevb/date/200506
>>>>
>>>> It gives an error:
>>>>
>>>> god at irt-smtp-02:~ 9:21am 65 # ./memleak.d 10312
>>>> dtrace: failed to compile script ./memleak.d: line 3: probe
>>>> description pid10312:libc.so.1:malloc:entry does not match any probes
>>>>
>>>> I am on SunOS 5.10 Generic_127112-07 i86pc i386 i86pc
>>>>
>>>> Are there some better scripts for isolating memory leaks?
>>>>
>>>> thanks
>>>> Fletch.
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> dtrace-discuss mailing list
>>>> dtrace-discuss at opensolaris.org
>>>>   
>>>>       
>>>>         
>>
>>
>>   
>>     
>
>
>   


-- 
Solaris Revenue Products Engineering,
India Engineering Center,
Sun Microsystems India Pvt Ltd.
Tel:    x27521 +91 80 669 27521 

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: memleak.d
Url: http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20080702/50968fb2/attachment.ksh 


More information about the dtrace-discuss mailing list