Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我拥有的模型包含大量代理。但是,我希望部分删除/消除一些在运行时完成工作的代理,以释放计算内存,加速模型执行并避免 OOM。
context.remove() 真的会永久消除/杀死代理(对象)吗?此操作后是否释放内存?如果不是,正确的程序是什么?
是的,这是正确的。除非您对代理有其他引用,否则将其从上下文中删除将允许对内存进行垃圾收集。