Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 machine.

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

like image 417
Lynton Grice Avatar asked Feb 03 '26 22:02

Lynton Grice


1 Answers

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).

like image 197
Wes Hardaker Avatar answered Feb 05 '26 13:02

Wes Hardaker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!