pencil2d / pencil

Pencil2D is an easy, intuitive tool to make 2D hand-drawn animations. Pencil2D is open source and cross-platform.
http://pencil2d.org
GNU General Public License v2.0
1.47k stars 273 forks source link

Memory leak when editing Stable Build files with Nightly Build editor. #1763

Closed RaykoEZ closed 1 year ago

RaykoEZ commented 1 year ago

Issue Summary

This may be me lacking critical information, or it may relate to #520 but the project files are saved and edited on the same hardware & OS platform, but with different builds

Actual Results

I didn't expect a file format to affect editor stability and crash my other running processes when I was just viewing frames and zooming in/out. Stable Build takes almost no memory for zooming and moving an empty file, the latest nightly build editor leaks 500MB per drag/zoom edit.

### Expected Results I would expect a PCLX file to behave the same across different builds/versions, or provide an error when a PCLX file is no longer compatible with a build. ### Video or Image Reference Link for how I reproduced this bug: https://youtu.be/lmbvWBJkdCU ### Steps to reproduce 1. Save as a file using the current stable build (v0.6.6) 2. Open Nightly Build Editor (I used 04/22/2023) 3. Open Recent, and select the file saved by v0.6.6 4. Try simple editing, focus on the Resizing UI panels, Zoom and Hand tool footprint ### System Information + Pencil2D Version: Nightly Build Apr 22 2023 + Operating System: Windows 10 (64-bit) + RAM Size: 32.0 GB (1GB set as budget) + Graphics Tablet: WACOM IntuosPro M (this bug affects mouse pointers too)
MrStevns commented 1 year ago

Hi Eric

Thanks for reporting this. I've investigated the problem and indeed there's a leak in our painting logic, causing it to create an image of the size of the canvas on every paint operation, when you have a vector layer in your timeline.

The reason you're not seeing the leak in the nightly build initially, only after opening a project file from the stable release is because we've removed the vector layer in the default setup. When you then import a pclx file from the stable release, the vector layer exists again, causing the leak to occur.

The leak however will be fixed together with this PR https://github.com/pencil2d/pencil/pull/1761

RaykoEZ commented 1 year ago

Indeed, I reproduced this behaviour after adding a vector layer on the Nightly Build.

Thanks!

MrStevns commented 1 year ago

Given that the PR hasn't been merged yet, let's keep the issue open. It will be closed automatically when the PR has been merged