当前位置: 动力学知识库 > 问答 > 编程问答 >

memory - Runtime error in while loop (Python)

问题描述:

I currently run into this error:

This application has requested the Runtime to terminate it in an unusual way.

Please contact the application's support team for more information.

Fatal Python error: PyEval_RestoreThread: NULL tstate

I can't upload the code so I'll try explaining it as much as I can. The code uses a camera library to capture image and save it in a folder. A while loop (while True:)is used so that each loop reads all the images in the folder (bmp), performs some calculation and returns the final result (an array). The result is displayed using matplotlib, I used plt.pause(0.0001) so that the image still show until the next loop comes.

Before the loop there are about 10 global variables are defined as ndarray with different sizes of [25,1000,1500], [25,1000*1500]. Most of them are float16 and float32.

The loop iterates fine until loop #5 then I have the error. I tried to increase the heap size but that doesn't work. Before this error I also get MemoryError, which I solved by reducing the data size and cleaned up the code.

I am using pycharm, anaconda 2.7 32 bit, window 10, 16 Gb RAM. Any ideas would be really appreciated!

Thanks a lot

分享给朋友:
您可能感兴趣的文章:
随机阅读: