InterviewSolution
| 1. |
How Do I Delete An Object In Memory? |
|
Answer» Julia does not have an analog of MATLAB's clear function; once a name is defined in a Julia session (technically, in module Main), it is always present. If memory USAGE is your concern, you can always replace objects with ones that consume less memory. For example, if A is a gigabyte-sized array that you no longer NEED, you can free the memory with A = nothing. The memory will be released the next time the garbage collector runs; you can force this to happen with gc(). Moreover, an ATTEMPT to USE A will likely result in an error, because most methods are not defined on type Nothing. Julia does not have an analog of MATLAB's clear function; once a name is defined in a Julia session (technically, in module Main), it is always present. If memory usage is your concern, you can always replace objects with ones that consume less memory. For example, if A is a gigabyte-sized array that you no longer need, you can free the memory with A = nothing. The memory will be released the next time the garbage collector runs; you can force this to happen with gc(). Moreover, an attempt to use A will likely result in an error, because most methods are not defined on type Nothing. |
|