Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

How do I attach a profiler to Ant?

I'll admit, I have very little experience working with a profiler - but I think I need one. Someone e-mailed me about testing all of AppFuse on a super-beafy box, and he got OOM errors after 17 minutes. For a dual CPU, 2Ghz Opterons, with 2GB RAM running RHEL3 workstation, it only made it to the Spring/AppGen test, which is #8 of 21. On my PowerBook, it makes it to #12, but my Linux box only make it to #8 too. My guess is there's some sort of memory leak in one of the testing tools - Tomcat, Cargo, WebTest or AppFuse itself.

Anyone have experience attaching a profiler to their Ant build or testing process to look for memory leaks?

Posted in Java at Dec 12 2004, 10:55:35 AM MST 10 Comments
Comments:

Download YourKit made by ex-Intellij employees. It will tell you the jvm options which you then set in an environment variable ANT_OPTS in your console before launching ant. Colin.

Posted by 219.88.91.45 on December 12, 2004 at 07:57 PM MST #

Your kid doesn't run on OS X. Matt try to increase the memory heap on ant. Mine looks like this for tough tasks and long intense tests: ANT_OPTS="-Xmn400m -Xmx400m -Xms400m -XX:NewRatio=2" hth. R P.S. For profilers I think jprobe work on the Mac.

Posted by Robert S. Sfeir on December 13, 2004 at 01:08 AM MST #

Ummm I meant Your kiT not your kiD :D

Posted by Robert S. Sfeir on December 13, 2004 at 01:09 AM MST #

You could also trying using JRockit. This eliminates the possibly of JVM specific leak and you also get access to profiler capabilities JRockit bundles for free: http://e-docs.bea.com/wljrockit/docs142/userguide/memleak.html

Posted by Blogic Blogger on December 13, 2004 at 01:56 AM MST #

I really like OptimizeIt, although I don't have specific Ant instructions. The general idea is to edit ANT_OPTS so you run the JVM with special flags so the profiler can attach to the Ant JVM process. Pretty much any Java profiler should do the trick...just focus on their instructions for connecting to a remote VM (the Ant process). Another thing to try is running the test suite through IDEA 4.5, rather than Ant. IDEA shows a table with memory usage before and after each test. You might be able to see which ones grab the most memory, although this won't be as reliable as a profiler. Finally, do your tearDown() JUnit methods (I'm assuming you are using JUnit) set all private fields to null? When you run a test suite through Ant, all of the tests are constructed and stay in memory. If your tearDown() does not set all refs to null, none of the data will get removed as your tests run.

Posted by Eric Burke on December 13, 2004 at 01:58 AM MST #

I doubt it's a problem with ANT. If you are not using fork="true" in your junit tasks then it all happens in the same JVM, so any singltons may hang around for a while. Using fork="true" may help you solve the problem without understanding what it is/ It's up to you if you think that's a good thing or not. BTW, you could use AOP as a form of profiler, non?

Posted by David Roussel on December 13, 2004 at 12:43 PM MST #

I know I have problems running my own application on Tomcat 4.1.31. I get OutOfMemory errors after I've reloaded it quite a few times. I haven't looked at your build script, but maybe you should start/stop the Tomcat process itself (and not just the web application).

Posted by François Beausoleil on December 13, 2004 at 01:20 PM MST #

Our development team uses JProfiler, which has excellent Mac OS X support, is easy to use, and works better than the leading brand name in terms of usable information displayed.

Posted by Gerry Power on December 13, 2004 at 02:24 PM MST #

I just spent 3 days tracking down a memory leak myself. I didn't have much luck with JProfiler since the leak was very subtle and I needed to have the server run in production for several hours. JProfiler always crashed the jvm before I could collect useful data. If you have a short-lived application, it should work great though. After that I tried Ariadna which looks very promising but doesn't show enough information yet to make it really useful. The author was very open to suggestions though and in time I think this will become a worthy open-source alternative. I finally traced everything without problems using Yourkit. Sadly it doesn't run on OSX, but they do hand out free licenses for open-source projects, which they gave me and all other RIFE developers.

Posted by Geert Bevin on December 13, 2004 at 11:06 PM MST #

[Trackback] On /. this morning I saw a headline on Google Digitizing Harvard's Library. I also saw a couple of headlines on freshnews.org that caught my eye, namely Free (and open) holiday greeting cards and How to get a job as a Linux administrator. My other bi...

Posted by life of a dred nerd on December 14, 2004 at 04:21 PM MST #

Post a Comment:
  • HTML Syntax: Allowed