-
Notifications
You must be signed in to change notification settings - Fork 4
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
Out of Memory Issue #2
Comments
Hi @MathNewBalance! Which operations do you use primarily? Would it be possible to create a simple repro with e.g a for loop that does the operations a 1000 times so we can easily figure out which functions to fix? Best, Erik |
HI Erik, Sorry for the slow reply, I have attached an example of the function I am running below. It runs every frame the mouse is moved over a canvas so been run pretty often UpdateOffset(MousePosition) {
this.clearPolyTree();
let i = 0;
let v = 0;
let OffsetedPath = undefined;
let Distance = 0;
this.SortPaths(MousePosition)
this.OffsetingPaths.push_back(this.currentGraphic.path);
for (i = 0; i < this.Graphics.length; i++) {
try{
this.OffsetingPaths.push_back(this.Graphics[i].path);
}
catch(err){
console.log(err);
}
}
for (i = 0; i < this.OffsetCount; i++) {
Distance = this.OffsetGap * i;
try{
OffsetedPath = this.clipper2.InflatePathsD(this.OffsetingPaths, Distance, this.clipper2.JoinType.Miter, this.clipper2.EndType.Polygon, 100.0, 3, 5);
}
catch(err){
console.log(err)
}
for (v = 0; v < OffsetedPath.size(); v++) {
try{
this.OffsetedPaths.push_back(OffsetedPath.get(v));
}
catch(err){
console.log(err);
}
}
OffsetedPath.clear();
OffsetedPath.delete();
}
this.ClipperObject.AddSubject(this.OffsetedPaths);
this.ClipperObject.AddClip(this.ShapeBoundary);
try{
this.ClipperObject.ExecutePoly(this.clipper2.ClipType.Intersection, this.clipper2.FillRule.EvenOdd, this.PolyPath)
}
catch(err){
console.log(err);
}
this.ClipperObject.Clear();
this.ClipperObject.delete();
this.FinalCount= this.PolyPath.count();
}``` |
Do you also clear OffsetingPaths and destroy it? anything that is created in JS must be destroyed as well in JS. |
Hi,
I am a big fan of the plugin and its super useful. However I am getting an issue with the plugin eventually running out of memory despite clearing and deleting structures after use and then flushing pending deletes. I wondered if you could give me any advice on how to fix this
Best wishes
Math Whittaker
The text was updated successfully, but these errors were encountered: