I recently set up a Tomcat 6.x server for our Documentum web apps, which are java-based. Annoyingly, I was regularly getting error messages saying there was insufficient memory and “PermGen” space. I won’t go into great detail about this, but at a high level, a java virtual machine (jvm) has internal memory allocations that are periodically garbage-collected, i.e. no-longer-needed allocations are cleaned out and the space freed. There is a lot of debate about why and whose code is at fault, but the fact remains it doesn’t seem to work very well right now, particularly for PermGen space. Fortunately, after much gleaning and some experimentation, I found some startup parameters that seem to have resolved it for me. YMMV and all that, of course.
In Tomcat on Windows (yeah I know), go to Start > All Programs > Apache Tomcat 6.0 > Configure Tomcat > Java and put these in the Java Options textbox. For any other platform or java server, you probably already know where these go. :) MaxPermSize may need tweaking depending on the java apps you are running. If you still get errors that indicate you are running out of PermGen, try increasing MaxPermSize, but there is a limit depending on your total memory allocation. I have mine set to 1024M max memory and Tomcat wouldn’t even start if I set MaxPermSize to large values like 512M. If you need that much PermGen you will need to allocate more total memory as well. MaxPermSize=128M seems to have been enough in my case. You’ll just have to experiment – or find a better blog post.
-XX:+UseConcMarkSweepGC
-XX:+CMSClassUnloadingEnabled
-XX:+CMSPermGenSweepingEnabled
-XX:MaxPermSize=128M
Categories: Uncategorized
I find 16-bit color desktops cause me more eyestrain than 32-bit, so I wanted my Windows Server 2008 remote desktops in all their 32-bit glory. By default, they are limited to 16-bit but this is easily remedied. Go to Start > Administrative Tools > Terminal Services Configuration (or Start > Run > tsconfig.msc), right-click the connection under Connections and select Properties, and select the Client Settings tab. Color Depth probably has Limit Maximum Color Depth checked and 16 bits per pixel in the dropdown. Uncheck it, or change the dropdown to 32 bits per pixel. Click OK and you’ll likely get a dialog about how this won’t change the current session. So close that and log off and back on, making sure your client is set to use 32 bits. You should now have a 32-bit display depth and a little less eyestrain.
Categories: Windows Server 2008
Unfortunately, I still have the occasional need to write a batch file that has to run on generic XP. And on such occassions, sometimes I want the script – if we can call it that – to wait for a couple of seconds at some point. Alas, XP has no sleep or similar command, but there is a way to simulate the functionality. I found the gist of this idea at Rob van der Woude’s Scripting Pages, and truth be told cannot believe I had never seen or thought of this before. The core idea is to use a number of ping commands to localhost.
So for example, I wanted to kill some Documentum Desktop processes that integrate with the explorer.exe task that makes up the Windows desktop interface. But, I wanted it to pause for a moment before relaunching explorer; ping to the rescue. Here is the batch file I ended up creating for the purpose.
@echo off
rem
rem Kills core Documentum Desktop processes and restarts Explorer so they relaunch
rem
taskkill /f /im dcathmgr.exe /im dcevtsrv.exe /im explorer.exe
rem tasklist /nh |sort
rem --- the next line just delays for a moment
ping -n 3 localhost >nul
start explorer.exe
The second-to-last line simply pings localhost 3 times, buying a couple of seconds of delay. You can adjust the number of times upward if you want it to wait a little longer. Normally the pings will be separated by a second, but the last attempt will terminate the ping command line so you really want number of seconds + 1, e.g. -n 6 would wait about 5 seconds.
And that’s all I have to say about that.
Categories: Microsoft Windows