I’m using Oracle Solaris Studio for some memory tests. I just installed it, and wrote the traditional “Hello World” program to make sure all is up and running correctly.
However, the Memory leaks tool reports that operator new is leaking 40 bytes…
I read that this was a common problem in older versions of visual studio with the MFC (Microsoft Foundation Classes) but now I’m very confused because this in an Oracle product… right?
As I understand it can be ignored. But it is annoying to see it pop up every time just because I print something.
Can something be done about it?
Thanks.
Here is the code:
#include <iostream>
int main(void)
{
std::cout<<"Hello World\n";
return 0;
}
I compiled with Sun Studio 12 and examined with TotalView:
There is indeed a heap allocation of 40 bytes without a matching deallocation, made by
__rwstd::facet_imp* __rwstd::facet_maker<std::codecvt<char,char,__mbstate_t>>::maker_func( int, const char*, unsigned ), called by__rwstd::facet_imp* std::locale::__make_explicit( const std::locale::id& ,bool, int, __rwstd::facet_imp*(*)(int,const char*,unsigned)) const, called byfilebuf::overflowcalled byfilebuf::synccalled byoperator<<.Note though that Oracle recommends compiling with
-library=stlport4unless you need binary compatibility with something built against their roguewave-based libCstd. Compiled with this option, there are no heap allocations made inmain()at all.