Replies: 8 comments 6 replies
-
Thanks for the report! That definitely sounds like a memory leak. I don't get that on Linux, so I would guess it might be a bad assumption in our Qt layer or our homemade text path caching. I know Qt handles fonts pretty differently on Windows.
I can dig into this on a VM later, but in the meantime if you'd be able to run a memory profiler over that and share the results it would help us find the bug quicker. Otherwise I can try to reproduce on my end later.
…-------- Original Message --------
On Jun 23, 2022, 11:38 PM, Xavman42 wrote:
I seem to be experiencing a memory leak when running the sample animation script in the documentation [here](https://neoscore.org/core_concepts/interactivity.html). My RAM fills up at a rate of ~300 MB per second at 10 fps, and that rate becomes faster as I increase fps. Is there any memory management I can do to fix this?
I am using Windows 10 and Python 3.10.5.
Thank you for your time.
from neoscore.common import *
import math
neoscore.setup()
center = Mm(50)
text = Text((center, Mm(50)), None, "moving text")
def refresh_func(time: float):
text.x = center + Mm(math.sin(time) * 20)
neoscore.show(refresh_func, 10)
—
Reply to this email directly, [view it on GitHub](#50), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/ADZ4OFSEAQUH3FIY6GTEMDDVQUUSFANCNFSM5ZWMLNCA).
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sure thing! Here's my implementation of the memory_profiler:
Here are the first two outputs:
And here are the last two outputs:
I'm not sure how informative this is, but I hope it helps somehow! |
Beta Was this translation helpful? Give feedback.
-
Ok, on my VM I can only reproduce a much smaller memory leak of about 0.5MB/s, and I can't reproduce any leak on my Linux host machine. The leak you're experiencing must be of a different nature than what I could reproduce since it's so much larger. I'm guessing Qt-related issues. Could you please run this modified example and upload the profile printed at the end? |
Beta Was this translation helpful? Give feedback.
-
Here you go! I'm not using Python best-practices and using a VM, but I wouldn't expect that to contribute to this particular issue. |
Beta Was this translation helpful? Give feedback.
-
Also, could you please run this other profiler-instrumented script?. It requires installing pympler first with |
Beta Was this translation helpful? Give feedback.
-
Ok it seems very likely to be on the Qt side. It might have to do with different font handling on some windows environments. Could you try running this simpler example which uses simple paths instead of text and let me know if you still see the leak? import math
from neoscore.core import neoscore
from neoscore.core.path import Path
from neoscore.core.point import ORIGIN
from neoscore.core.units import ZERO, Mm
neoscore.setup()
p1 = Path.rect(ORIGIN, None, Mm(2), Mm(1))
p2 = Path.rect(ORIGIN, None, Mm(1), Mm(3))
center = ZERO
def refresh_func(time):
p1.x = Mm(math.sin((time / 2)) * 10)
p2.x = Mm(math.sin((time / 2) + 1) * 12)
if __name__ == "__main__":
neoscore.show(refresh_func) |
Beta Was this translation helpful? Give feedback.
-
Sorry for the slow progress here, this is a tough one. I just tried reproducing on an actual Windows 10 laptop and couldn't see the leak there either. What version of Windows 10 are you on? Are you using the Windows Subsystem for Linux by any chance? I don't think it's likely I'll be able to crack this without reproducing on my end. |
Beta Was this translation helpful? Give feedback.
-
No worries! If it's just a me issue, then maybe I'll just dual-boot Win 10 and Ubuntu and call it a day. Device name LAPTOP-482T2PL Edition Windows 10 Home |
Beta Was this translation helpful? Give feedback.
-
I seem to be experiencing a memory leak when running the sample animation script in the documentation here. My RAM fills up at a rate of ~300 MB per second at 10 fps, and that rate becomes faster as I increase fps. Is there any memory management I can do to fix this?
I am using Windows 10 and Python 3.10.5.
Thank you for your time.
Beta Was this translation helpful? Give feedback.
All reactions