Memory Debugging on (Open)Solaris
March 2, 2009
We know there are many commercial tools to debug memory on Solaris systems as Dynamic Suite and Purify. But I prefer to use open source tools always it is possible.
Well, Linux has many open source tools and the best in my opinion is Valgrind, but Valgrind will not be ported to sparc architecture as well to (open)solaris. Then, what tool I should use ?
(Open)Solaris has useful tools to debug memory, the most known is DTrace, but I’ll talk of two important and easiest tools to use: libumem and watchmalloc (equivalent to MALLOC_CHECK from linux).
Using libumem
It’s not need to recompile your application. The library is loaded dynamically by LD_PRELOAD environment variable.
- Prepare your environment
$ setenv UMEM_DEBUG default
$ setenv UMEM_LOGGING transaction
$ setenv LD_PRELOAD libumem.so.1
- Run the application normally
$ ./myapp
- After the program has passed by all fluxes, generate a core to analyze with mdb
$ gcore `pgrep myapp`
- mdb means Solaris Modular Debugger
$ mdb myapp core.pid
- With mdb opened, just run a simple command (findleaks):
> ::findleaks -dvf CACHE LEAKED BUFCTL CALLER 0014f12f 1 00067000 libumem.so.1`malloc+0x0 ---------------------------------------------------------------------- Total 1 buffer, 48 bytes
Using watchmalloc
Watchmalloc is the linux equivalent to MALLOC_CHECK. The use is most simple than libumem. See it:
- Prepare your environment
$ setenv MALLOC_DEBUG=WATCH,RW
$ setenv LD_PRELOAD watchmalloc.so.1
- Run the application normally
$ ./myapp
- When a leakage happens the program will generate a core dumped and will be possibly to analyze with gdb.

Brazilian Planet OpenSolaris
February 18, 2009
Enabling a Marvel Yukon NIC on OpenSolaris
January 11, 2009
When I installed OpenSolaris 2008.05 in my laptop (Sony Vaio), the operating system does not recognized my ethernet card (marvel yukon), but identified my wireless NIC.
I don’t use ethernet card frequently because I have a Wireless Access Point. But, some days ago I had to enable my Marvel Yukon.
Let’s see how did I do this:
By default, snv_86 build does not come with the Marvel Yukon driver enabled in the kernel. But you can download it at:
http://homepage2.nifty.com/mrym3/taiyodo/myk-2.6.5.tar.gz
Done that, I take these steps:
-
tar -zxvf myk-2.6.5.tar.gz
-
cd myk-2.6.5
-
rm -Rf obj Makefile
-
ln -s Makefile.i386_gcc Makefile
-
ln -s i386 obj
-
export PATH=/usr/ccs/bin:$PATH
-
which gcc (/usr/ccs/bin/gcc expected)
-
which make (/usr/ccs/bin/make expected)
-
pfexec make install
-
pfexec ./adddrv.sh (should says ok!)
-
ifconfig myk0 plumb
-
ifconfig -a (wow ! I see my ethernet card!!!
)
PS: Before try my tips, please, read the installation document in tarball ’cause you can have to do different steps.
Links:
PostgreSQL for Solaris
September 27, 2008
Oh, this weekend is happening the PostgreSQL Conference 2008 in Brazil. It’s a great opportunity to post in my blog something related with it. As Sun Microsystems will be a sponsor of the Conference, I will talk a little about PostgreSQL for Solaris.
First, a bad notice that Josh Berkus is no longer in Sun. =(
Second…
Well, I’m not a OpenSolaris expert, but I like it. Always I have to setup or make PostgreSQL tricks on Sun Operating Systems (SunOS/Solaris or OpenSolaris) I consult some useful links:
- Main wiki
- Best Practices Howto (by Jignesh K. Shah – US PGCon 2008)
- Sun Guide to PostgreSQL
Go PostgreSQL, Go !!!
Art and Open Source
August 17, 2008
Today, I was reading tools that need to be converted or to be packaged into Solaris/OpenSolaris. One of the tools most awaited is Inkscape.
Well, now, I’m trying to compile Inkscape (svn version [1]) into my OpenSolaris. I thought to follow this tutorial, but it must be overcome and it’d take much of my time. =D
If I can compile and ran Inkscape binaries, I’ll notice in my blog and I’ll upload the package to OpenSolaris repositories.
Remember that Open Source is not only coding, visit this site and give a change to yourself: http://codefree-mag.org/
Think, breath and contribute in different ways and how you can to open source projects. We need you.
[1] – https://inkscape.svn.sourceforge.net/svnroot/inkscape/inkscape/trunk
That’s all folks.
Updating OpenSolaris
August 15, 2008
Hello all,
in my last post I have wrote about Firefox 3 on OpenSolaris. Björn corrected me about it. Firefox3 is already in snv_95 image.
Currently, OpenSolaris 2008.05 livecd has been with environment snv86. So, let’s learn how to update your OpenSolaris image.
- Update package list
pkg refresh
- Upgrade your environment: it will create a new image to preserve and secure your current image
pkg image-update
- After some cups of coffee (a big and boring download :/), you will see this message:
A clone of opensolaris exists and has been updated and activated. On next boot the Boot Environment opensolaris-1 will be mounted on '/'. Reboot when ready to switch to this updated BE.
- To see your environments, just do it:
beadm list
- Now, let’s notice the grub about the changes:
pfexec mount -F zfs rpool/ROOT/opensolaris-1 /mnt
pfexec /mnt/boot/solaris/bin/update_grub -R /mnt/
- Reboot and choice “Solaris 2008.11 snv_95 X86“
OpenSolaris
August 14, 2008
Finally, I’ve decide to install OpenSolaris on my Sony Vaio laptop. It functions perfectly…video, audio, flashplayer and wireless.
I installed the OpenSolaris 2008.05 in a 50GB partition. Then, I think I have enough space to make my experiences.
And now, I’ll install Firefox3 on my OpenSolaris box. This package can be find here.










