相关疑难解决方法(0)

建议使用哪种Python内存分析器?

我想知道我的Python应用程序的内存使用情况,并且特别想知道哪些代码块/部分或对象占用了大部分内存.Google搜索显示商业广告是Python Memory Validator(仅限Windows).

开源的是PySizerHeapy.

我没有尝试任何人,所以我想知道哪一个是最好的考虑:

  1. 提供大部分细节.

  2. 我必须对代码进行最少或不做任何更改.

python performance profiling memory-management

657
推荐指数
8
解决办法
22万
查看次数

Python进程使用的总内存?

有没有办法让Python程序确定它当前使用了多少内存?我已经看过有关单个对象的内存使用情况的讨论,但我需要的是进程的总内存使用量,以便我可以确定何时需要开始丢弃缓存数据.

python memory-management

229
推荐指数
10
解决办法
20万
查看次数

如何在Python中分析内存使用情况?

我最近对算法感兴趣,并开始通过编写一个简单的实现,然后以各种方式优化它来探索它们.

我已经熟悉用于分析运行时的标准Python模块(对于大多数事情我已经发现IPython中的timeit魔术功能已足够),但我也对内存使用感兴趣,所以我也可以探索这些权衡(例如,缓存先前计算的值表的成本与根据需要重新计算它们的成本.是否有一个模块可以为我分析给定函数的内存使用情况?

python memory profiling

198
推荐指数
7
解决办法
21万
查看次数

类的实例使用什么资源?

How efficient is python (cpython I guess) when allocating resources for a newly created instance of a class? I have a situation where I will need to instantiate a node class millions of times to make a tree structure. Each of the node objects should be lightweight, just containing a few numbers and references to parent and child nodes.

For example, will python need to allocate memory for all the "double underscore" properties of each instantiated object (e.g. the docstrings, …

python memory-management cpython class instance

14
推荐指数
4
解决办法
500
查看次数