Various Utility Functions

Memory Functions

Mathematica keeps memory references to symbols that appear in Out cells. That prevents the garbage collector from reclaiming the allocated memory even after a symbol has been Clear[]ed or Remove[]d. It means the memory is allocated permanently. This behavior comes surprising to many Mathematica programmers who expect the memory not be kept permanently.

utility_1.gif

utility_2.gif

utility_3.gif

utility_4.gif

utility_5.gif

utility_6.gif

utility_7.gif

utility_8.gif

Therefore the function JClearMemory[] has been created for JavaTools, which, when called after a Clear[] or Remove[] of a symbol, will ensure the memory is released back to the operating system.

utility_9.gif

utility_10.gif

utility_11.gif

utility_12.gif

utility_13.gif

utility_14.gif

utility_15.gif

utility_16.gif

It is important to call JClearMemory[] immediately after the Remove[] or Clear[], or it will not work.

Another way to deal with this is to simply use the Google Collections that JavaTools provides. You can store any data of primitive data type (Real, Integer, String) as well as Mathematica expressions in Google Collections with the appropriate JavaTools functions.

Various Other Utility Functions

utility_17.gif

utility_18.gif

utility_19.gif

utility_20.gif

utility_21.gif

utility_22.gif

utility_23.gif

utility_24.gif

utility_25.gif

utility_26.gif

utility_27.gif

utility_28.gif

utility_29.gif

utility_30.gif

utility_31.gif

utility_32.gif

Note that the output of JFormat[] is a String!

Zip Files

JavaTools offers a file zipper.

In[9]:=

utility_33.gif

Obtain Server Messages / Announcements

In[11]:=

utility_34.gif

utility_35.gif

This function informs you about recent updates relevant to JavaTools, such as a new Java version or a new Google Guava / Collections version, or an upgraded version of JavaTools itself, or other types of announcements. You are recommended to upgrade to a new Java, Guava, or JavaTools version as soon as it is available, ESPECIALLY when Oracle has also updated the security baseline when updating Java (the most current security baseline is Java 7 update 3, while the most current Java version is Java 7 update 4.). Feel free to request a new version of JavaTools that is recompiled with the updated version(s) by sending an email containing your name and $MachineID to javatools@lauschkeconsulting.net. You will receive a new version of JavaTools compiled with the updated libraries from Lauschke Consulting within 24 hours.

Spikey Created with Wolfram Mathematica 8.0