Clojure memory usage

725 views
Skip to first unread message

Anurag Ramdasan

unread,
Jan 25, 2014, 12:44:28 PM1/25/14
to clo...@googlegroups.com
I've been playing around with clojure for a while now but never actually made anything in it.
Today I started looking around into pedestal and started following its tutorials. Once I kept the 
server running for a few hours I noticed that it took upto 500MB of my ram even though it wasn't really 
doing anything. Is pedestal usually this memory hungry? 

I know that usually things running on JVM have some amount of memory usage. Are all full-fledged apps 
written in Clojure usually memory intensive? If not, does clojure have a lightweight, less memory consuming 
web framework?

Thanks,
Anurag Ramdasan.

Jarrod Swart

unread,
Jan 25, 2014, 1:55:40 PM1/25/14
to clo...@googlegroups.com
This was talked about here: https://groups.google.com/forum/#!searchin/clojure/user$3A$20g$20vim/clojure/XqPGnX5aSAI/PoLYaydgX3cJ

TLDR: The JVM carves out its own chunk of memory from the OS.  It then uses very advanced and finely tuned means to manage said memory.  So even though the app isn't doing anything the JVM is still using its memory.  Best to load up your app and profile it with VisualVM to see what is actually going on.

Cedric Greevey

unread,
Jan 25, 2014, 5:32:20 PM1/25/14
to clo...@googlegroups.com
You might want to use the G1 collector (JVM opt UseG1GC) if you're using Java 7 as I've heard that the G1 collector gives memory back to the OS more readily than the other options.


--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to
clojure+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Sean Corfield

unread,
Jan 25, 2014, 5:43:03 PM1/25/14
to clo...@googlegroups.com
On Jan 25, 2014, at 2:32 PM, Cedric Greevey <cgre...@gmail.com> wrote:
> You might want to use the G1 collector (JVM opt UseG1GC) if you're using Java 7 as I've heard that the G1 collector gives memory back to the OS more readily than the other options.

My experience with Java 7 and the G1 collector in production would not support that. However, the G1 collector certainly evens out the sawtooth memory usage patterns you often see with the JVM (prior to G1 / Java 7) which makes for smoother response times etc.

Sean Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)



signature.asc

Anurag Ramdasan

unread,
Jan 27, 2014, 10:49:39 AM1/27/14
to clo...@googlegroups.com
That sounds good. I am running openjdk1.7. I havent tried the tools yet but I would give it a shot.
I quite like the idea of pedestal and dont want memory issue to be a reason for me to not use it.

Thanks,
- Anurag Ramdasan.
Reply all
Reply to author
Forward
0 new messages