Jump to content
Ultimaker Community of 3D Printing Experts
ahoeben

Cura 3.5 memory leak in Monitor

Recommended Posts

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

@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

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

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
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
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

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

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
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

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

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

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Our picks

    • Introducing Ultimaker Cura 3.6 | Beta
      Ultimaker Cura 3.6 | Beta is available. It comes with new features, bug fixes, and UX improvements. We would really like to have your feedback on it to make our stable release as good as it can be. As always, you can download the beta for free from our website, for Windows, MacOS, and Linux.
        • Like
      • 92 replies
    • Print Core CC | Red for Ruby
      Q: For some users, abrasive materials may be a new subject matter. Can you explain what it is that makes a material abrasive when you are not sure which print core to use?
      A: Materials which are hard in a solid piece (like metals, ceramics and carbon fibers) will generally also wear down the nozzle. In general one should assume...
        • Like
      • 30 replies
    • "Back To The Future" using Generative Design & Investment Casting
      Designing for light-weight parts is becoming more important, and I’m a firm believer in the need to produce lighter weight, less over-engineered parts for the future. This is for sustainability reasons because we need to be using less raw materials and, in things like transportation, it impacts the energy usage of the product during it’s service life.
        • Like
      • 12 replies
×

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!