Can using Valgrind on Linux also help when the app is compiled on Solaris?
I have written a C application that is destined to be on a Solaris SPARC system. However the majority of my development has been on my Mint Linux 64 bit machi开发者_开发百科ne.
I have seen I have a small memory leak and have been using Valgrind on Linux to check it out.
My question is: If I run Valgrind on Linux and make all the memory leak stuff 100% (or at least close to that), if I can compile the application on Solaris does it mean that it should also behave the same (meaning I do not have to use Solaris specific memory leak detection tools?)
Reason I ask is I doesn't really have the time to learn all these profiling tools for each platform.....I am hoping that if Valgrind tells me to fix something that the fix will also work on Solaris?
I know the memory management between Linux and Solaris would be quite different, but surely on memory leak detection they would be kind of the same?
Any advice / help would be greatly appreciated ;-)
Lynton
Generally speaking, if the code execution path is the same on both systems and you clean up the memory leaks on one then yes, it will clean them up on the other system too.
It's not quite so straight forward when things differ between the machines though. EG, it tries to do one thing on the linux system and another thing on the solaris system.
Valgrind is a great tool and the best thing to do is try it on linux and see if it cleans up the leaks on solaris too (check with ps or another tool that lists the memory size under solaris and make sure it doesn't increase there).
精彩评论