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

Memory leaks into OccupancyGridClient #440

Closed
letis33 opened this issue Sep 18, 2021 · 2 comments
Closed

Memory leaks into OccupancyGridClient #440

letis33 opened this issue Sep 18, 2021 · 2 comments
Labels

Comments

@letis33
Copy link

letis33 commented Sep 18, 2021

The current grid object is not removed from root object into OccupancyGridClient.processMessage() function.
=> only from sceneNode

Memory is growing very fast...

processMessage(message){
  // check for an old map
  if (this.currentGrid) {
	  // check if it there is a tf client
	  if (this.currentGrid.tfClient) {
	    // grid is of type ROS3D.SceneNode
	    this.currentGrid.unsubscribeTf();
	  }

**==>**	  this.sceneNode.remove(this.currentGrid);

	  this.currentGrid.dispose();
  }
  • Library Version: latest (develop branch)
  • ROS Version: Noetic
  • Platform / OS: Ubuntu 20.04

Steps To Reproduce

Launch continuousmap.html

Expected Behavior

mrdoob.github.io/stats.js/build/stats.min.js shall have memory stable
=> about 150MB in my case

Actual Behavior

Memory is growing until Chrome freeze
=> several giga bytes

Quick fix

this.rootObject.remove(this.currentGrid); instead of this.sceneNode.remove(this.currentGrid);

@letis33 letis33 added the bug label Sep 18, 2021
@MatthijsBurgh
Copy link
Contributor

I think your solution is not complete. Because of

// check if we care about the scene
if (this.tfClient) {
this.currentGrid = newGrid;
if (this.sceneNode === null) {
this.sceneNode = new ROS3D.SceneNode({
frameID : message.header.frame_id,
tfClient : this.tfClient,
object : newGrid,
pose : this.offsetPose
});
this.rootObject.add(this.sceneNode);
} else {
this.sceneNode.add(this.currentGrid);
}
} else {
this.sceneNode = this.currentGrid = newGrid;
this.rootObject.add(this.currentGrid);
}

When tfclient resolves to false, I think this.rootObject.remove(this.currentGrid) is correct, but when tfclient resolves to true, this.sceneNode.remove(this.currentGrid) is correct. Do you agree?

@letis33
Copy link
Author

letis33 commented Sep 20, 2021

Hi,

I'm totally agree with you.

Thanks for your reply.

trusktr added a commit to trusktr/ros3djs that referenced this issue Oct 1, 2021
…asses

* upstream/fix_440:
  Fix RobotWebTools#440, correctly delete old grid
  Add missing semi-colon
  Update Build
  Bump rollup from 2.56.3 to 2.57.0 (RobotWebTools#443)
  Bump mocha from 9.1.1 to 9.1.2 (RobotWebTools#442)
  Bump @rollup/plugin-node-resolve from 13.0.4 to 13.0.5 (RobotWebTools#441)
k-aguete pushed a commit to k-aguete/ros3djs that referenced this issue Oct 21, 2022
Bumps [grunt-karma](https://github.com/karma-runner/grunt-karma) from 4.0.0 to 4.0.2.
- [Release notes](https://github.com/karma-runner/grunt-karma/releases)
- [Changelog](https://github.com/karma-runner/grunt-karma/blob/master/CHANGELOG.md)
- [Commits](karma-runner/grunt-karma@v4.0.0...v4.0.2)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants