I know the documentations says:
Julia does not have an analog of MATLAB’s
clearfunction; 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
Ais 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
Awill likely result in an error, because most methods are not defined on type
This has been discussed some time ago but I didn’t want to post on old threads because it’s not well regarded here.
Anyway, the only solution provided there was replacing the content with nothing or forcing the user to use let blocks or local variables.
Is this situation going change at any time soon?
Replacing the content of the object with nothing is not the solution. The user can end up having hundreds of nothing objects. Listing all variables or quickly searching for anything on memory can be a chaos.
Most programming languages do have ways to remove objects from memory.
The problem is even worse when you cannot remove a function method.