Open dongho-shin opened 1 year ago
oh I found it... https://github.com/0beqz/realism-effects/blob/main/src/ssgi/utils/EquirectHdrInfoUniform.js
updateFrom(map) {
map = map.clone()
const { width, height, data } = map.image
const { type } = map
this.size.set(width, height)
return new Promise(resolve => {
this.worker?.terminate()
this.worker = new Worker(workerUrl)
this.worker.postMessage({ width, height, isFloatType: type === FloatType, flipY: map.flipY, data })
this.worker.onmessage = ({ data: { data, totalSumValue, marginalDataArray, conditionalDataArray } }) => {
this.dispose()
I think function dispose in EquirectHdrInfoUniform should terminate workers I'll make a PR for this
dispose() {
this.marginalWeights.dispose()
this.conditionalWeights.dispose()
this.map.dispose()
}
Oh thanks for seeing that, it can indeed be problematic for memory. I should fix that before releasing the new version.
I tried to test this pr(https://github.com/pmndrs/react-postprocessing/pull/211) for test in react-postprocessing
I found when SSGIEffect instance created, Javascript VM instance has added so I think it is kind of workers but I can't find where the worker created in chrome Mac OS