2024-03-28 19:52:20 发布
网友
当我在Windows中运行这个Python脚本时,进程会增长,但看不到明显的结束:
import os for i in xrange(1000000): for root, dirs, files in os.walk(r"c:\windows"): pass
我误解什么了吗? (我使用的是python2.7.3。)
这是由于在中发现内存泄漏操作系统路径.isdir;见Huge memory leak in repeated os.path.isdir calls? 您可以使用一个Unicode编码的路径字符串来测试它—应该没有泄漏。在
在操作系统路径.isdir用于手术室步行实施:
islink, join, isdir = path.islink, path.join, path.isdir try: names = listdir(top) except error, err: if onerror is not None: onerror(err) return dirs, nondirs = [], [] for name in names: if isdir(join(top, name)): dirs.append(name) else: nondirs.append(name)
这是由于在中发现内存泄漏操作系统路径.isdir;见Huge memory leak in repeated os.path.isdir calls? 您可以使用一个Unicode编码的路径字符串来测试它—应该没有泄漏。在
在操作系统路径.isdir用于手术室步行实施:
相关问题 更多 >
编程相关推荐