Close releases the resources held by the execution frame and returns it to the pool.
()
| 175 | |
| 176 | // Close releases the resources held by the execution frame and returns it to the pool. |
| 177 | func (f *ExecutionFrame) Close() { |
| 178 | if f.parent == nil && f.ctx != nil { |
| 179 | if f.ctx.cancel != nil { |
| 180 | f.ctx.cancel() |
| 181 | f.ctx.cancel = nil |
| 182 | } |
| 183 | f.ctx.ctx = nil |
| 184 | f.ctx.gate = nil |
| 185 | asyncCallStateTrackerPool.release(f.ctx.asyncCalls) |
| 186 | f.ctx.asyncCalls = nil |
| 187 | f.ctx.observer = nil |
| 188 | f.ctx.interrupt = nil |
| 189 | f.ctx.state = nil |
| 190 | f.ctx.costs = nil |
| 191 | f.ctx.memory = nil |
| 192 | f.ctx.interrupted.Store(false) |
| 193 | f.ctx.interruptCheckCount.Store(0) |
| 194 | f.ctx.interruptCheckFrequency = 0 |
| 195 | evalContextPool.Put(f.ctx) |
| 196 | } |
| 197 | f.ctx = nil |
| 198 | f.parent = nil |
| 199 | f.costTracker = nil |
| 200 | f.functions = nil |
| 201 | if f.vars != nil { |
| 202 | f.vars = nil |
| 203 | clear(f.lazyVars) |
| 204 | } |
| 205 | f.scope = nil |
| 206 | frameStack.Put(f) |
| 207 | } |
| 208 | |
| 209 | // Push pushes the given activation onto the activation stack and returns the new frame. |
| 210 | // |