[Scilab-users] Still available memory on the Java heap

classic Classic list List threaded Threaded
4 messages Options
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] Still available memory on the Java heap

Hello,

Is there a way equivalent to getmemory() to get the free memory on the
reserved Scilab java heap?

xmlGetValues() can be used to get the total reserved java heap amount,
but i would need to know the still free not yet used memory.

Thanks
Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: Still available memory on the Java heap

Hello Samuel,

You can get memory information from the JVM using JIMS:

--> jimport java.lang.Runtime

--> Runtime.getRuntime().totalMemory()
 ans  =

  249036800


--> Runtime.getRuntime().freeMemory()
 ans  =

  175335480

Regards,

--
Clément DAVID

> -----Original Message-----
> From: users <[hidden email]> On Behalf Of Samuel Gougeon
> Sent: Thursday, July 18, 2019 11:21 AM
> To: International users mailing list for Scilab. <[hidden email]>
> Subject: [Scilab-users] Still available memory on the Java heap
>
> Hello,
>
> Is there a way equivalent to getmemory() to get the free memory on the
> reserved Scilab java heap?
>
> xmlGetValues() can be used to get the total reserved java heap amount, but i
> would need to know the still free not yet used memory.
>
> Thanks
> Samuel
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Still available memory on the Java heap

Hello Clément,

Le 22/07/2019 à 16:01, Clément David a écrit :

> Hello Samuel,
>
> You can get memory information from the JVM using JIMS:
>
> --> jimport java.lang.Runtime
>
> --> Runtime.getRuntime().totalMemory()
>   ans  =
>
>    249036800
>
>
> --> Runtime.getRuntime().freeMemory()
>   ans  =
>
>    175335480

Excellent!
Thanks a lot.

Samuel

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Still available memory on the Java heap

In reply to this post by Clément David-3
Hello,

Le 22/07/2019 à 16:01, Clément David a écrit :
Hello Samuel,

You can get memory information from the JVM using JIMS:

--> jimport java.lang.Runtime

--> Runtime.getRuntime().totalMemory()
 ans  =

  249036800

I do not get an amount matching the Scilab setting:

--> jimport java.lang.Runtime
--> Runtime.getRuntime().totalMemory()
 ans  =
  111149056

--> // while we could expect, with my Scilab < 6.0.2 session
--> getPreferencesValue("//general/body/java-heap-memory","heap-size")
 ans  =
 256

--> // or with Scilab >= 6.0.2:
--> xmlGetValues("//general/body/java-heap-memory","heap-size")
 ans  =
 256

What could explain this difference? There is still much more than 256 MB free RAM on my computer.
From here, is the amount of available Java memory as doubtful as for the total memory?

Best regards
Samuel

PS: related java page: https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Runtime.html




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users