This code retrieves an instance from the pool, avoiding the memory allocation, construction, and eventual garbage collection.
代码从池中检索到一个实例,从而避免了内存分配、构建和最终的垃圾回收。
When using an object pool, the allocation, initialization, collection, and finalization only occur once, reducing both the memory usage and the processing time that is required.
在使用对象池时,分配、初始化、回收和终结只发生一次,从而减少了内存使用和所需的处理时间。
For most collector implementations, the allocation subsystem keeps a pool of free heap memory, consumed by the application through allocating objects and replenished by the collector through sweeping.
对大多数收集器实现而言,分配子系统持有一个自由堆内存池,应用程序通过分配对象使用该池,然后由收集器通过清理来补充该池。
应用推荐