-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Labels
Description
Description
When I call ROS3D.MarkerArrayClient in my web, I see the web memory is increasing until crashing from Task Manager
- Library Version: latest (develop branch)
- ROS Version: melodic
- Platform / OS: Ubuntu 18.04
Steps To Reproduce
function init() {
// Create the main viewer.
var viewer = new ROS3D.Viewer({
divID: 'radar_markers',
background: '#707070',
width: 650,
height: 650,
antialias: true,
displayPanAndZoomFrame: false
});
// Setup a client to listen to TFs.
var tfClient = new ROSLIB.TFClient({
ros: ros,
angularThres: 0.01,
transThres: 0.01,
rate: 100.0,
fixedFrame: '/rslidar'
});
var gridClient = new ROS3D.Grid({
num_cells: 20
});
var axesClient = new ROS3D.Axes({
});
viewer.addObject(gridClient);
viewer.addObject(axesClient);
var markerArrayClient1 = new ROS3D.MarkerArrayClient({
ros: ros,
tfClient: tfClient,
topic: '/vis_s1_objects',
rootObject: viewer.scene
});
var markerArrayClient2 = new ROS3D.MarkerArrayClient({
ros: ros,
tfClient: tfClient,
topic: '/vis_s2_objects',
rootObject: viewer.scene
});
var markerArrayClient3 = new ROS3D.MarkerArrayClient({
ros: ros,
tfClient: tfClient,
topic: '/vis_s3_objects',
rootObject: viewer.scene
});
}
Expected Behavior
Open Chrome web, the memory is stable
Actual Behavior
Memory is growing fast until crashing in several minutes
My Action
In below ros3djs MarkerArrayClient class processMessage(arrayMessage) function, when I remove " this.rootObject.add(this.markers[key]); " , the web memory will become stable, so I guess maybe here will be the issue, does anybody know how to fix?
processMessage(arrayMessage) {
arrayMessage.markers.forEach(function(message) {
var key = message.ns + message.id;
if (message.action === 0) {
var updated = false;
if (key in this.markers) { // "MODIFY"
updated = this.markers[key].children[0].update(message);
if (!updated) { // "REMOVE"
this.removeMarker(key);
}
}
if (!updated) { // "ADD"
var newMarker = new Marker({
message: message,
path: this.path,
});
this.markers[key] = new SceneNode({
frameID: message.header.frame_id,
tfClient: this.tfClient,
object: newMarker
});
this.rootObject.add(this.markers[key]);
}
} else if (message.action === 1) { // "DEPRECATED"
console.warn('Received marker message with deprecated action identifier "1"');
} else if (message.action === 2) { // "DELETE"
this.removeMarker(key);
} else if (message.action === 3) { // "DELETE ALL"
for (var m in this.markers) {
this.removeMarker(m);
}
this.markers = {};
} else {
console.warn('Received marker message with unknown action identifier "' + message.action + '"');
}
}.bind(this));