首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Python脚本填充内存

Python脚本填充内存
EN

Stack Overflow用户
提问于 2013-09-06 04:02:02
回答 1查看 543关注 0票数 0

我正在编写一个累积消耗内存的脚本,我不知道如何解决这个问题。任何帮助或建议,我们将不胜感激。

不知何故,Python垃圾收集器失败了,这是怎么回事?

下面是代码示例,下面是一些注释。

我怀疑罪魁祸首是psspy,但我无法访问它的代码,有什么解决办法吗?

ierr都是整数。

variable1等是包含单个数字列表(整数、实数或复数)的列表。

代码语言:javascript
复制
import psspy
psspy.psseinit(1200)

cases = []
... #Construction of a list of strings containing filenames like 'case010.sav'
faults = []
... #Construction of another list that doesn't contribute to the problem.

for filename in cases:
    psspy.case(filename) #It opens a 'case' that alters the output of the following functions
    ierr, variable1 = psspy.function1(parameters)
    ierr, variable2 = psspy.function2(parameters)
    ...
    ierr, variablen = psspy.functionn(parameters)
    ...
    for fault in faults:
        psspy.close_powerflow() #Documentation says it  
             #'Removes the current powerflow working case from PSS®E’s working memory.'
        psspy.case(filename)
        ...
        ierr, variable1 = psspy.function1(parameters)
        ierr, variable2 = psspy.function2(parametersl)
        ...
        ierr, variablen = psspy.functionn(parameters)
        ...
EN

回答 1

Stack Overflow用户

发布于 2013-09-06 04:06:24

这可能确实是psspy名称空间中存在某种泄漏。为了更全面地了解内存的使用情况,您应该使用one of the Python profilers

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/18644926

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档