I'm coding a machine learning procedure that works with large datasets and some other related calculations. Since the datasets could be very large, some calculations result into very large matrices (for example 29,000 x 29,000 Array{Float64,2}), and they need large amounts of storage (RAM). Later in the procedure some elements (like the initial dataset) are not required anymore but they are still wasting memory space.
Is there a way to "free" variables at some moment? Or instead, is there a way to share some hard disk portion, something like swap space?
In Julia 0.6. You can remove the variable and free up it's memory by calling clear!() .
A return type can be specified in the function declaration using the :: operator. This converts the return value to the specified type. This function will always return an Int8 regardless of the types of x and y .
You can clear the Workspace from the Console by pressing Ctrl+D to end Julia and Enter to start it again.
Just to wrap this up... typical approach is to overwrite objects that are consuming memory unnecessarily with ones that require very little memory. Taken from the FAQ (as linked above):
For example, if A is a gigabyte-sized array that you no longer need, you can free the memory with A = 0. The memory will be released the next time the garbage collector runs; you can force this to happen with gc().
If you wish to create a new workspace (i.e. clear all variables), this is done with
workspace()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With