|
From: Marian K. <mar...@ci...> - 2012-04-24 06:56:56
|
Dear Valgrind community, I am currently trying to use massif on a huge programming project, and I want to isolate some allocations that aren't significant. I use the --ignore-fn option like this: valgrind --tool=massif --ignore-fn=SDL_CreateRGBSurface --ignore-fn='CCircletechString::DebugUpdateL()' --ignore-fn='CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned int,unsigned int)' (etc etc etc) ./a.out Now... some of the ignores are respected, for example CCircletechString::DebugUpdateL(), and some of them aren't, for example CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned int,unsigned int). It is always the same ignores that aren't respected (the respecting behavior does not change between massif runs). The non-respected ignores show up in the final memory log. Many, but not all the ignores that aren't respected are ignores of static C++ methods. The non-respected method CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned int,unsigned int) returns something, but even if I try to overwrite the ignore like this: valgrind --tool=massif --ignore-fn=SDL_CreateRGBSurface --ignore-fn='CCircletechString::DebugUpdateL()' --ignore-fn='TFontTextureBuffer* CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned int,unsigned int)' (etc. etc. etc.) ./a.out it does not help at all. Is it possible that --ignore-fn does not work with static C++ methods? Using the --verbose flag while running massif seems to indicate that all the --ignore-fn options are parsed: 0 ... SDL_CreateRGBSurface 1 ... CCircletechString::DebugUpdateL() 2 ... CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned int,unsigned int) etc. The code is a mixture of C (about 5 per cent of the code) and C++ (the rest of the code). My version of valgrind is 3.6.1. I compiled valgrind 3.7.0 from sources to test it, it (mis)behaves the same. The Linux kernel is 3.2. Any help is appreciated. Marian Kechlibar |
|
From: <pa...@fr...> - 2012-04-24 07:32:57
|
----- Original Message ----- > Dear Valgrind community, > > I am currently trying to use massif on a huge programming project, > and I > want to isolate some allocations that aren't significant. > > I use the --ignore-fn option like this: > > valgrind --tool=massif --ignore-fn=SDL_CreateRGBSurface > --ignore-fn='CCircletechString::DebugUpdateL()' > --ignore-fn='CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned > int,unsigned int)' (etc etc etc) ./a.out Hi Have you tried using the mangled C++ name? Normally I use nm to find the mangled names. with and without -C. A+ Paul |
|
From: Julian S. <js...@ac...> - 2012-04-24 09:53:46
|
On Tuesday, April 24, 2012, pa...@fr... wrote: > ----- Original Message ----- > > > Dear Valgrind community, > > > > I am currently trying to use massif on a huge programming project, > > and I > > want to isolate some allocations that aren't significant. > > > > I use the --ignore-fn option like this: > > > > valgrind --tool=massif --ignore-fn=SDL_CreateRGBSurface > > --ignore-fn='CCircletechString::DebugUpdateL()' > > --ignore-fn='CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned > > int,unsigned int)' (etc etc etc) ./a.out > > Hi > > Have you tried using the mangled C++ name? > > Normally I use nm to find the mangled names. with and without -C. According to this http://valgrind.org/docs/manual/ms-manual.html#ms-manual.options the names that should be given are demangled, iow there is no need to demangle them. Maybe the &s or some other characters in the command line arguments are not getting handled properly by the shell? Also ... --ignore-fn='CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned int,unsigned int)' did you remove the spaces between the parameter names? J |
|
From: Manuel D. <ma...@de...> - 2012-04-24 10:07:28
|
On Tue, Apr 24, 2012 at 11:45 AM, Julian Seward <js...@ac...> wrote: > > Maybe the &s or some other characters in the command line arguments > are not getting handled properly by the shell? in bash: $ echo "a&b" a&b $ echo 'a&b' a&b $ echo a&b [1] 4711 <- Process ID of background process "echo a" a <- Result of "echo a" bash: b: command not found <- bash complains [1]+ Done echo a <- "echo a" has terminated $ echo a\&b a&b Unfortunately, if you are calling valgrind by a shellscript (not unpopular due to the length of the command), the escaping varies a little. Better you try out yourself in the script. regards, Manuel |
|
From: Marian K. <mar...@ci...> - 2012-04-24 17:23:11
|
Hello, I found out... CRYPTO_malloc does not allocate the memory itself. It invokes some other function within libssl.so. This function does not have any name, and is shown as ??? (I use massif visualizer to view the results). Is it possible to suppress all allocations from certain library, like libssl.so? Best regards Marian Dne 24.4.2012 15:58, Julian Seward napsal(a): > On Tuesday, April 24, 2012, you wrote: >> Dear Julian, >> >> yes, you were right, and the spaces seem to matter. >> >> (I am a bit surprised, as I wouldn't expect that; from compiler's point >> of view they are inert). >> >> But it seems that once I enter the method name precisely as reported by >> nm -gC, including >> the spaces after the commas, the --ignore-fn starts to work. >> >> And no mangling was necessary. >> >> I found yet another interesting problem, though. >> >> In the openssl library, there is a method called CRYPTO_malloc. I want >> to set it as a custom allocator; massif does not allow me to, or, again, >> ignores my attempts to do so from the command line. > No idea .. check you have the name right, check the function really > got compiled in, and not inlined everywhere. > > J > >> Again, tried with spaces, without spaces, full signature, or no... >> >> Best regards >> >> Marian >> >> Dne 24.4.2012 12:07, Julian Seward napsal(a): >>> On Tuesday, April 24, 2012, you wrote: >>>> Hello, >>>> >>>> yes, I removed the spaces between the parameter names. Does that matter? >>> I don't know for sure but I would guess it does. >>> >>> J >>> >>>> Best regards >>>> >>>> Marian >>>> >>>> Also ... >>>> >>>> --ignore-fn='CSDLUtil::CreateFontTextureBuffer(MShineFont&,unsigned >>>> int,unsigned int)' did you remove the spaces between the parameter >>>> names? J |
|
From: Manuel D. <ma...@de...> - 2012-04-24 17:41:23
|
On Tue, Apr 24, 2012 at 7:22 PM, Marian Kechlibar <mar...@ci...> wrote: > I found out... > > CRYPTO_malloc does not allocate the memory itself. It invokes some other > function within libssl.so. > This function does not have any name, and is shown as ??? > > (I use massif visualizer to view the results). The function surely has a name, but valgrind is not able to find out the name, because you are probably not linking to the debug version (-g -O0) of the library. If you can, it is always nice to link to the debug versions of your dependencies, alas slower. ~manuel |