Can I make Julia forget a method from the REPL

耗尽温柔 提交于 2019-12-12 18:13:52

问题


If I'm playing in the REPL and I've defined a few different methods for a function:

julia> methods(next)
# 3 methods for generic function "next":
next(i::BigInt) at none:1
next(i::Int64) at none:1
next(i) at none:1

Can I make Julia forget some or all of these?


回答1:


In short, no.

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 = 0. The memory will be released the next time the garbage collector runs; you can force this to happen with gc().

(source)



来源:https://stackoverflow.com/questions/33927523/can-i-make-julia-forget-a-method-from-the-repl

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!