Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Object is still referenced by renderItems in WebGLRenderList, after it is removed from scene. #12621

Closed
clineyuan opened this issue Nov 10, 2017 · 4 comments

Comments

@clineyuan
Copy link

clineyuan commented Nov 10, 2017

After an object was removed from scene, it is still referenced by renderItems. I clear renderItems as below. But the object may be referenced by opaque or transparent. Once I clear opaque and transparent, nothing is rendered(only background color)! I don't how to get it fixed. Could you please double check if the original code is correct and if not how to fix it?

`function WebGLRenderList() {

	var renderItems = [];
	var renderItemsIndex = 0;

	var opaque = [];
	var transparent = [];

	function init() {

		renderItemsIndex = 0;
		opaque.length = 0;
		transparent.length = 0;

		# renderItems = [];
	}`
Three.js version
  • r88
@Usnul
Copy link
Contributor

Usnul commented Nov 10, 2017

I do not understand what your problem is. You have not explain what you are doing, what happens and how it differs from your expectations.

The code you have provided does not help to clarify this situation for me.

Please consider editing your post.

@clineyuan
Copy link
Author

clineyuan commented Nov 10, 2017

Usnul, in my project, threejs objects will be added to and removed from scene frequently. Once I remove them from scene, I suppose that they should be not referenced by THREE. But when I use Chrome dev tool to take a snapshot, I found "renderItems" still kept some of them.

The above code only assigns zero to renderItemsIndex, but doesn't make renderItems empty. I think it causes the "memory leak".

@aardgoose
Copy link
Contributor

This is a duplicate of #12447 which is addressed by PR #12464 (not merged yet)

@clineyuan
Copy link
Author

Great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants