Python memory footprint vs. heap size

后端 未结 4 927
有刺的猬
有刺的猬 2020-12-28 21:41

I\'m having some memory issues while using a python script to issue a large solr query. I\'m using the solrpy library to interface with th

4条回答
  •  感情败类
    2020-12-28 22:08

    I've implemented hruske's advice of "fork and die". I'm using os.fork() to execute the memory intensive section of code in a child process, then I let the child process exit. The parent process executes an os.waitpid() on the child so that only one thread is executing at a given time.

    If anyone sees any pitfalls with this solution, please chime in.

提交回复
热议问题