May cause gl buffer memory leak?

On the file buffer.ts navigate to the method Buffer#rebuild

I found

  public _rebuild(): void {
      this._buffer = null;
      this.create(this._data);
  }

Maybe this will create a new WebGLBuffer lead js untrack WebGLBuffer ?
but I think WebGLBuffer even untrack by javascript,It should still call the gl.deleteBuffer

I have found the behavior in the dispose method
maybe we should call dispose first?

ping @Evgeni_Popov

These _rebuild methods (there are others than in the Buffer class) are only used in the context of a lost webgl context, so we should not try to dispose of the current resource because it is invalid (due to the lost context) and would produce errors.

2 Likes

Got it :smiley: