<分区>
在C++中,局部变量存储在栈中,而new操作符创建的数据存储在堆中。那么,Python 中的变量呢?它们存储在哪里?
<分区>
在C++中,局部变量存储在栈中,而new操作符创建的数据存储在堆中。那么,Python 中的变量呢?它们存储在哪里?
最佳答案
复制自 Python documentation :
Memory management in Python involves a private heap containing all Python objects and data structures. The management of this private heap is ensured internally by the Python memory manager. The Python memory manager has different components which deal with various dynamic storage management aspects, like sharing, segmentation, preallocation or caching.
关于python - Python中的变量存放在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17764997/