Oct 212009
 

I was attempting to work with VisualVM and Tomcat over the past few days on Snow Leopard and it was constantly failing. I was getting errors like this:

I was also getting errors inside VisualVM and from the command like using jmap that went like this:

And I also got some other strange errors from jmap like this one:

I opened an issue with the VisualVM team and they tested things out on Snow Leopard and said it all worked fine. I figured they were smokin’ something and decided to try a Sun product and see if it worked. I fired up NetBeans and sure enough, VisualVM and jmap worked great. This indicated it was definitely a VM configuration issue.

Here’s the what you need to do to get your Java applications working with the VM tools on Snow Leopard. Add the following parameters to the java command and everything will start working fine:

The -Xverify:none is the setting that allows VisualVM and jmap to capture thread dumps. Without this setting, you’ll get strange errors like those above. The -Xshare:off gets VisualVM working without any startup errors or random failures. The last setting is really just for JConsole and other JMX tools.

Enjoy!

Dec 022008
 

I’m not a huge C++ developer nor a VS wizard, so I thought I would write down how I got GoogleTest setup in a C++ project I’m using VS 2008 for.

  1. Download it
  2. Add it as an existing project to your solution by right clicking on the “Solution ‘your-project'” part of the Solution Explorer
  3. Compile it (if you want)
  4. Right click your project and open the Properties
  5. Click on ‘Common Properties -> Frameworks and References’
  6. Add a Reference to the GoogleTest project
  7. Click on ‘Configuration Properties-> C++’
  8. Under the ‘Additional Include Directories’ add the a new directory that points to the include directory inside the GoogleTest distribution
  9. Click on ‘Configuration Properties -> C++ -> Code Generation’ and change all of the projects to ‘Multi-threaded Debug (/MTd)’

Another thing I realized is that it is probably best to create a separate project for the tests within your solution. I created a Win32 Console Application project in my solution and followed the above steps for that project. I also then needed to add a reference to the project I am testing within my test-project. (Slightly annoying, cumbersome and verbose).