sbt ~jetty-run leaks

39 views
Skip to first unread message

j...@webmaster.ms

unread,
Dec 24, 2011, 12:56:18 PM12/24/11
to Lift
Hello.

I am newbie in webdev using lift and scala.

I set up the Windows dev environment as described in this excellent
tutorial video http://vimeo.com/27162278 (the project is here:
https://github.com/pkufashuo400/liftweb-skeleton) with one exception -
I did not install JRebel.
Just ran "sbt ~jetty-run" allowing Jetty be restarted each time the
code is changed.

After 4-5 changes I get OutOfMemory error.
Windows task manager shows increasing of the memory consumption by
150Mb on each Jetty restart.
So, initially, java.exe uses about 150M, then 300Mb after the first
restart, 450Mb after the second restart, etc, then crashes on the 4th
or the 5th restart.

Did anybody encounter the same problem?

Is there a way to set up a daemon which will be watching the sources
and restart Jetty big number of times?
4..5 times is too small for my needs, because I am learning the
framework, make the changes, see what happens, etc.

Thank you!

Alexey Lunacharsky

unread,
Dec 26, 2011, 4:30:02 AM12/26/11
to Lift
Hi.

Yes such a problem exists and I usually restart the SBT when this
happens.
So the better solution will be interesting for me too.

What can I propose for you is to still setup JRebel and use ~prepare-
webapp instead of ~jetty-run.
This will make you environment to run into that issue not so often.

BTW there is more recent version of xsbt-web-plugin available:
https://github.com/siasia/xsbt-web-plugin/wiki

Hope that helps, Alexey.

On Dec 24, 11:56 pm, "j...@webmaster.ms" <j...@webmaster.ms> wrote:
> Hello.
>
> I am newbie in webdev using lift and scala.
>
> I set up the Windows dev environment as described in this excellent
> tutorial videohttp://vimeo.com/27162278(the project is here:https://github.com/pkufashuo400/liftweb-skeleton) with one exception -

David Pollak

unread,
Dec 26, 2011, 1:21:27 PM12/26/11
to lif...@googlegroups.com
Here's the script I use to launch sbt:

java -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512m -Xmx1512M -jar `dirname $0`/sbt-launcher.jar "$@"

Note that class unloading is enabled and that I've bumped up the size of the perm gen area.

By default the JVM does not unload classes once they are loaded and loaded classes are kept in the "perm gen" (permanent generation) heap space.  This is mostly what you want because the cost of loading and JITing classes is high.  But during development or if you've got a container that is changing what apps it runs, it's best to allow unloading of the classes and also to set perm gen to a reasonably big number. 


--
Lift, the simply functional web framework: http://liftweb.net
Code: http://github.com/lift
Discussion: http://groups.google.com/group/liftweb
Stuck? Help us help you: https://www.assembla.com/wiki/show/liftweb/Posting_example_code



--
Visi.Pro, Cloud Computing for the Rest of Us http://visi.pro
Lift, the simply functional web framework http://liftweb.net


Reply all
Reply to author
Forward
0 new messages