我们正在编写一个内存紧张的系统.有多个python进程将导入同一组类.如果进程加载了大量的类,每个进程消耗了几百兆,那么就有10个进程,我正在进行演出.有没有办法跨python进程"共享"类导入?
摘要:
import classA # Process 1 : loads classA in memory
import classA # Process 2 : reuses what was loaded previously by Process 1
Run Code Online (Sandbox Code Playgroud)
PS:我想要实现的是用.soC/C++中的模块做的事情.