[dtrace-discuss] FW: Memory Leak Problem in My Application running on Solaris 10.
Vladimir Marek
Vladimir.Marek at Sun.COM
Mon Jun 9 04:53:27 PDT 2008
> We have real-time application written C++ which runs on Solaris 10
> having a problem that's the my application grows in size from 130 Mb
> to 450Mb in around 15 days.
Just to be sure that you know, free(3c) does not return memory back to
system. Sorry if I repeat well known fact.
============================= man free(3c) =============================
The argument to free() is a pointer to a block previously
allocated by malloc(), calloc(), or realloc(). After free()
is executed, this space is made available for further allo-
cation by the application, though not returned to the sys-
tem. Memory is returned to the system only upon termination
of the application. If ptr is a null pointer, no action
occurs. If a random number is passed to free(), the results
are undefined.
========================================================================
This means that if you allocate 100Mb buffer, free it and allocate 30Mb
buffer, you will see still 100Mb RSS. C++ delete and delete[] operators
are built on top of the same mechanism.
It is left to the OS to swap out unused memory pages.
[...]
> 1) Is there any way where I can restrict dtrace to look for probe only
> certain source files or functions?
Source files, AFAIK no. Functions yes. I guess that you want to
distinguish between allocations made in some specific functions and the
rest of the allocations ?
> 3) I got a clue of using "libgc.so" which acts as garbage collector is
> there any problem in using and how reliable and effective is this.
I would also be interested.
> ( it works fine on sample application but not improvement in real
> application ). I just linked the library "libgc.so" at compile time ?
> Anything else need to done for this ?
For C++ I think that you have to use -library=gc
> Your inputs will be highly appreciated. Please do share your thoughts
> and techniques.
I would try to make libumem work, it should give you the data.
Not sure if this helps :)
--
Vlad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 193 bytes
Desc: not available
Url : http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20080609/6fbb8a13/attachment.bin
More information about the dtrace-discuss
mailing list