Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Explicitly clean all memory usage

class State():
    def __init__(self):
        self.value = []

state0 = State()
state0.value = range(10^8)

At this point, a huge memory is located. After processing state0.value, I set it back to empty to continue another process.

state0.value = []

However, the memory is not fully cleaned. Therefore, I cannot continue another process due to my limitation of memory, and I have to close Sagemath 8.4 to get back to the fresh memory. It is better to iterate, instead of using memory like this; however, I hope that an explicit memory clean exists in Sagemath. Besides it, I use range(10^8) to illustrate my actual 10^8 data in type of set to ease the understanding, so please do not support on re-formulating this usage of range.

Explicitly clean all memory usage

class State(): def __init__(self): self.value = [] []

state0 = State()
state0.value = range(10^8)

At this point, a huge memory is located. After processing state0.value, I set it back to empty to continue another process.

state0.value = []

However, the memory is not fully cleaned. Therefore, I cannot continue another process due to my limitation of memory, memory on my computer, and I have to close Sagemath 8.4 to get back to the fresh memory. It is better to iterate, instead of using memory like this; however, I hope that an explicit memory clean exists in Sagemath. Besides it, I use range(10^8) to illustrate my actual 10^8 data in type of set to ease the understanding, so please do not support on re-formulating this usage of range.