Jump to content
ahoeben

Cura 3.5 memory leak in Monitor

Recommended Posts

Posted · Cura 3.5 memory leak in Monitor

I have seen a couple of mentions in passing of memory leaks in Cura 3.5 while viewing the print monitor. These mentions were in a topic that quickly ballooned and became ineffective to discuss this particular problem, so let's try to get to the bottom of this in a thread dedicated to this issue.

 

It seems the problem may be shared between Cura Connect and OctoPrint. This would not be strange, because they use a lot of the same code.

@kmanstudios mentioned it here (I can't find the original report he mentions), and afaik he does not use OctoPrint.

https://community.ultimaker.com/topic/24675-new-ultimaker-cura-35/?do=findComment&comment=221744

@StefanoCAD also reported a memory leak and seems to be using Cura Connect

https://community.ultimaker.com/topic/24675-new-ultimaker-cura-35/?do=findComment&comment=221232

 

Both @Adam324 and @nbJosh report a memory leak with OctoPrint

https://community.ultimaker.com/topic/24675-new-ultimaker-cura-35/?do=findComment&comment=221686

 

Note that in my cursory testing I cannot (yet) reproduce the memory leak with the OctoPrint Connection plugin. But I am just a single 3rd party developer that does not have a testing team, so please bear with me.

 

Because the memory usage increases so quickly, the camera feed is - to me - the most likely candidate for causing the leak. The code for displaying the camera feed is also shared between Cura Connect and OctoPrint. For the OctoPrint Connection plugin this hypothesis can be tested fairly quickly by turning off the camera feed. Adam324 and nbJosh, as a first step in narrowing down the problem, can you try if the memory leak still occurs after you go back to the "Connect to OctoPrint" dialog and uncheck the "Show webcam image" checkbox?

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

I've tried switching on the camera with Cura connect a few times on Fedora, but I don't get the memory leak (or any network issues ?

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

@ahoeben is correct, I do not use octoprint.

 

And maybe memory leak is not the correct term. But I notice it increases in CPU usage and will interfere with other programs if used over a period of time. I can at least track the CPU usage. I will see what else I can offer as well.

 

When I use the program, its usage balloons and never goes back down even when reset or even rebooted. I will try to get around to just showing this usage with screenshots a bit later today.

 

I also do not use the camera as the machines are right around me and I am not gone long enough to worry about it at any given time.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

I also noticed a huge increase of CPU usage when opening the camera, but it is in my opinion not related to Cura itself. Also when opening the URL directly in a browser window, my Safari browser gives a notice that this webpage consumes a lot of "energy" which means CPU.

 

So there must be something strange (whatever) with this video stream webpage.

 

I use now a workaround and open the stream url in VLC player, there it is working without an increase of CPU usage.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

I'm not a 100% sure (so please; try and figure out of this works for you, it will help us a great deal to fix it).

 

It seems the issue only occurs for "newly added machines". So if a machine is loaded from file, the memory leak doesn't occur. If you add a new machine and view the camera without closing it down it should occur. 

 

 

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

It happens for me with a machine that was imported from previous version.  It is repeatable every time I launch Cura.  I plan to test the 'don't show video' thing when I am home later today.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

I unchecked 'Show webcam image' but it still shows the webcam video.  I even restarted Cura.  It is unchecked but the webcam video is still streamed.  Memory leak still occurs too.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor
2 hours ago, Adam324 said:

I unchecked 'Show webcam image' but it still shows the webcam video.  I even restarted Cura.  It is unchecked but the webcam video is still streamed.  Memory leak still occurs too.

I for one; thank you for your ongoing effort to share as able with the development team to insure that this is corrected.

 

Takes care.

  • Like 1

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor
3 hours ago, Adam324 said:

I unchecked 'Show webcam image' but it still shows the webcam video.  I even restarted Cura.  It is unchecked but the webcam video is still streamed.  Memory leak still occurs too.

 

Thanks for testing. Hmm, that's a bug by an off itself. I will make a fix for that.

 

In the mean time, we can still test the hypothesis of the camera feed leading to the memory leak. In the OctoPrint settings, on the Webcam & Timelapse tab, could you clear the Stream URL field? Then restart Cura. I know this is in no way a solution, but it is a temporary test to diagnose the issue.

Share this post


Link to post
Share on other sites
Posted (edited) · Cura 3.5 memory leak in Monitor

I am not running the cam or any other thing but Cura and Cura Connect.

System is i7-770K 4.2 Ghz

32GB Ram

Nvidia GForce GTX 1080

Win 10 ?

 

Just opening Cura

FirstOpen.thumb.jpg.3ef65b59e4cb861b18ecaefd9178ae4a.jpg

 

Just sitting there, growing little by little

JustSittingThere.thumb.jpg.ca54ce18348624cfeb50289ce22cb50d.jpg

 

And growing

JustSittingThere2.thumb.jpg.1b60aa017d0bd6ee02fb1c95784b3dba.jpg

 

Loading first file: file size 59,553 kb

LoadFirstFile.thumb.jpg.5db4aa44fa1cbd846c04a68731c69762.jpg

 

Just doing file settings

DoingFileSettings.thumb.jpg.29b9146ddd670d26b2c07cc8d1ed6b82.jpg

 

During slice

Slicing.thumb.jpg.421ff9e533a2eaec6435f629099a0d55.jpg

 

Finished slicing

FinishedSlicing.thumb.jpg.4ce486a8d46dd5ed8ba14d358f0c6424.jpg

 

After sending file to Cura Connect

AfterSendingFile.thumb.jpg.2232147242649a959a2c630df526937c.jpg

 

Load second file: File size 48,262 kb

LoadSecondFile.thumb.jpg.55bf4e9375f39f21e3d7763115831469.jpg

 

Second file sliced

SecondFileSliced.thumb.jpg.5593962542f3b7ecb48604e35be5b872.jpg

 

After closing and reopening

AfterClosingAndReopening.thumb.jpg.dd6af509c446433b9be139dfa97095f6.jpg

 

So, when using, it grows and grows. Even loading files that are not that large, it will jump astronomically comparative to the file loaded. Slicing I expect it to use resources as shown and not so bad.

 

But it will continue to grow if it just sits there and will not return to original file usage, even on restart. It may be minimal, but it will keep creeping up if doing a lot of work. And, if you do not close it, it will keep getting really large.

 

Maybe not a memory leak in strictest of terms, but it does not release its usage of resources fully and during ops, it will get really large and just start conflicting with all sorts of things left and right as it just consumes resources. It appears to, but it gains back that usage very quickly from this point on.

 

Sorta like this guy:

 

Edited by kmanstudios
  • Thanks 1

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

If the memory usage is growing while it is just "sitting there", it is definitely a memory leak, however small the increase is (and in this case the increase is NOT small).

 

Note that it is not too surprising that when loading a small file the memory use grows by much more than the file size. A file in use in an application can take up much more memory than the file; the file is optimised for storage, the data when loaded into the application is much more optimised for usage, and it can be in memory multiple times, optimised for different usages (eg for display AND for slicing).

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

@kmanstudios Thanks for the expansive report. We're looking into this right now. I hope to get back to you with a solution (or at least a few more questions so we can figure it out)

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor
17 minutes ago, ahoeben said:

If the memory usage is growing while it is just "sitting there", it is definitely a memory leak, however small the increase is (and in this case the increase is NOT small).

 

Note that it is not too surprising that when loading a small file the memory use grows by much more than the file size. A file in use in an application can take up much more memory than the file; the file is optimised for storage, the data when loaded into the application is much more optimised for usage, and it can be in memory multiple times, optimised for different usages (eg for display AND for slicing).

I expect a growth of 3 - 4 times the size of the file.....not aprox. 10 times the file size. But even that growth is higher when still in use.

 

12 minutes ago, nallath said:

@kmanstudios Thanks for the expansive report. We're looking into this right now. I hope to get back to you with a solution (or at least a few more questions so we can figure it out)

No worries...I figured this would be helpful. I can provide a link to the files in question if need be for exact comparison.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

Ok...this is where to post on this.....I could not find it. I have been battling tech for three days now. Between Win 10 and silly printer things, I lost this thread.

 

 

This is where I can post from now on.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

Here is a more dramatic example:

First opened:

FirstOpen.thumb.jpg.c3fc50d3da36ce1d70abf4416338c86c.jpg

 

But, after about two hours of leaving it open and not doing anything else.

LeftItOpen.thumb.jpg.0576abdcb6c1e99c3895f1a4e6110592.jpg

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

prepare tab. I had checked a model to see where my hollow was to put in weights. So it was sliced and in layer view. Tht is why it stayed open for so long. To gauge when to drop in weights.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

That is usefull info, and might mean there are multiple leaks/mechanisms; the OctoPrint leak seems to happen on the Monitor tab only (if it happens)

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

I am seeing the same with 3.5 beta on Win 10 and I am using the Octoprint plugin.

 

It is not clear to me where the memory is leaking, but TaskManager does not show memory reserved for Cura.  That stays modest around 250 to 300MB in my case but my 8GB system runs out of memory after a couple days.  The total in TaskManager goes over 90%, Cura shows maybe 300MB but when I exit Cura, the total memory in use drops from 90% back down to 30ish %.

 

Given the above behavior, perhaps there is a leak associated with a driver and memory is getting allocated at the system level but not charged to the Cura process.

 

I'll load RAMMap and try to get more data if that would help.

 

Thanks,

 

Stephan

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

On MacOS Mojave with Cura 3.5.1 Cura uses around 300Mb of memory and is stable. Switching Prepare <-> Monitor doesn't change this allocation. No network connected printer available here tho.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

Here it is a lot more on macOS Mojave with Cura 3.51

313838447_Bildschirmfoto2018-10-21um21_57_43.thumb.png.5d8f4e758f97ba8c6cc933ab92f65508.png

 

I am on the prepare screen and build plate is clean. Before I sliced a very small object not more than 50 layers.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

Unless the memory use is steadily climbing without apparent reason, let’s not make this thread a “my Cura is using N amount of memory” bidding war. Loading objects, slicing them and showing layerview are expexted to be very memory intensive 

 

When responding in this thread, please mention if you use OctoPrint or CuraConnect.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

The memory leaks I provided information on was not using either process. At the time Cura Connect had dumped out on me and could not get it back until the prints were finished on the machines they hook into.

Share this post


Link to post
Share on other sites
Posted · Cura 3.5 memory leak in Monitor

I found, right after my post, that I had accidently left Cura open while I was asleep. So, in order of events:

 

 

Finding I left Cura open:

LeftOpenFor8Hours.thumb.jpg.3f54af1ba3f59e9d614e2c8ecbccf81b.jpg

 

Closed Cura, reloaded same file:

FreshOpenFileLoaded.thumb.jpg.9e456f1184ae3eb32e094c54000c1d88.jpg

 

Sliced the file:

FreshOpenFileSliced.thumb.jpg.441ef715c01f7c786106a9ac8a154e51.jpg

 

Now, I usually would not post things so out of order, but, the file I opened was the same one that was sitting there when I discovered that Cura had been left open. Though out of usual reporting order, I have no doubt that the memory reported in usage was the same as I had noticed before. I have been keeping an eye out for the memory usage in general lately. But I was surprised to see that the memory had grown by 300% just by sitting there.

 

This time, Cura Connect was in usage, but not in the monitor window.

 

The difficulty I have is this: It really interfere's with my work process. This would be to have three programs open for tweaking purposes.

 

Files going back and forth from 3DSMAX, 3D Coat and Cura as I tweak designs and substitute things. An example of that would be when I am working on an interior for one of my spaceship type models. I design the base mesh, pass it to 3D Coat for detailing, back to MAX and then to Cura. If it does not slice (say, too thin), then I work back and forth between the programs until I get a good slice on that set of parts. Eventually, mahem ensues, programs crash and my system is eaten up with crash junk and lost time and reboots just because of this type of issue.

 

And, with 32 GB of RAM, it should not come to that.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Our picks

    • Ultimaker Cura 4.0 | Stable available!
      Ultimaker Cura 4.0 is mainly focused on the improved user interface and cloud integration.
      As always, we want to collect your user feedback for this release. If there are any improvements you can think of, feel free to mention it here and help us to shape the next release.
      • 86 replies
×
×
  • Create New...

Important Information

Welcome to the Ultimaker Community of 3D printing experts. Visit the following links to read more about our Terms of Use or our Privacy Policy. Thank you!