* 预填充池 * @param count 预填充的对象数量
(count: number)
| 142 | * @param count 预填充的对象数量 |
| 143 | */ |
| 144 | public prewarm(count: number): void { |
| 145 | const actualCount = Math.min(count, this._maxSize - this._objects.length); |
| 146 | |
| 147 | for (let i = 0; i < actualCount; i++) { |
| 148 | const obj = this._createFn(); |
| 149 | obj.reset(); |
| 150 | this._objects.push(obj); |
| 151 | this._stats.totalCreated++; |
| 152 | this._stats.size++; |
| 153 | } |
| 154 | |
| 155 | this._updateMemoryUsage(); |
| 156 | } |
| 157 | |
| 158 | /** |
| 159 | * 设置最大池大小 |
no test coverage detected