Home > other > How python used up a function, real-time release the memory
How python used up a function, real-time release the memory
Time:10-25
Format has two functions, for example, roughly as follows, hand to play, ignore the format Because funb will produce a lot of memory, how do I call after the release of memory
Def funb (x) : The count=0 For I in range (1, x + 1) : Count=count + I
Def funa () : Print funb (10000000000)
Main: Funa ()
CodePudding user response:
I understand it, if it is used in a function list, element inside a large increase, after return, local variables should be automatically release the memory
CodePudding user response:
You understand funb produce large amounts of memory, a lot of? The count? For computer bottom, count like a basket, has been to a basket to add something, a memory, so will not produce a lot of, I? An I a basket, generated a with a finished generating, reoccupy, also won't produce large amounts of memory,
If: you are here defines a variable x, x is a basket, then the function after the operation, these baskets are recycled, (to be automatic recovery) Python on the basis of their own language, the recovery of memory has been done,
If you want to understand memory usage, go to learn C language, learn more image points,