Used Memory => how to mesure it?
SlimerDude
10 Jun 2012
Assuming you want to look at JVM memory usage, there's a host of JVM profiling tools out there... but for basic stuff you can just use JConsole that's bundled with the JDK.
- Start your Fantom app
- type
JConsoleon the command line - select your Fantom process from the list
brian
10 Jun 2012
You can get current heap usage from:
Env.cur.diagnostics["mem.heap"]
In general most important two things for managing JVM memory:
- give yourself enough heap size on startup
- make sure have nice working chunk of that heap (for example steady state heap usage is only 60% of max or whatnot)
Xan
10 Jun 2012
Thanks, brian. @SlimerDude: my app is too short for waiting jconsole... thanks
Is there any not JVM-specific tool for that? That we can use for C or python scripts and compare JVM against those?
Thanks, Xan.
Xan
10 Jun 2012
I get error with this:
echo("Memòria consumida ${echo(Env.cur.diagnostics["mem.heap"]}")
$ fan mget-memoria.fan /home/xan/proves/yot-ng/propi/codi/aranya-fantom/mget-memoria.fan(61,57): Unexpected end of Str literal, missing } ERROR: cannot compile script
What happens? Wrong syntax?
Thanks, Xan.
brian
10 Jun 2012
Don't try to use a string literal inside a string literal (in fact we are going to make that an error)
echo("Memòria consumida " + Env.cur.diagnostics["mem.heap"])
Xan
11 Jun 2012
Mmmm... thanks, but with "$var" don't you punt the value of the variable var? Why don't work this?
Xan.
Xan
10 Jun 2012
Hi,
Is there any tool for knowing how much memory is used by Fantom program? If it's, it could be used too for non-fantom programs?
Thanks, Xan.