vbagcl 2022-04-30 17:05
浏览 9
已结题

python程序内存泄漏咋解决?

用python写的图片识别的程序,运行一次没有问题,发布成API后,只能执行一次,执行第二次报错
terminate called after throwing an instance of 'std::bad_alloc'
利用objgraph.show_growth()进行跟踪,第一次运行显示:
tuple 75890 +75890
function 63563 +63563
dict 43981 +43981
list 20219 +20219
cell 17363 +17363
weakref 15575 +15575
getset_descriptor 9597 +9597
set 7623 +7623
builtin_function_or_method 7106 +7106
method_descriptor 6907 +6907
运行第二次显示:
tuple 794581 +718691
list 117171 +96952
dict 105779 +61798
Tensor 18838 +17931
Operation 18136 +17304
_InputList 17966 +17144
TF_Output 17488 +16719
cell 24821 +7458
Dimension 7481 +7141
TensorShape 4761 +4586
如何清理泄漏的内存?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 5月8日
    • 创建了问题 4月30日