-
Notifications
You must be signed in to change notification settings - Fork 35
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
Memory usage issue #8
Comments
Strangely I cannot replicate the memory issue on my setup (native linux) The crashing might be fixed (at least it didn't crash for the last ten Still, something is happening at around layer 250 or so (that's where On 19.10.2016 00:16, Youness Alaoui wrote:
|
That's weird, because I'm not the only one with the memory issue as far as I know, @nickthetait, can you confirm ? |
I just finished porting your changes in fixSlicer to VTK6 and tested it, the memory issue is half-gone. Instead of it jumping to 4GB of RAM instantly, it quickly increases RAM usage to about 900MB, then slowly keeps increasing while slicing up to 1.5GB, then once slicing is done, it drops back to ~1MB of RAM usage. So the changes you did in fixSlicer had a very positive impact on the memory problem. |
My test system is Debian Jessie with 8 processor cores and 16GB of RAM. Using https://github.com/robotsinthesun/monkeyprint/tree/fixSlicer things seem much better. Only 5% RAM usage and ~12% CPU. First try it sliced in under a minute without crashing 👌 |
Thank @nickthetait for the report. |
Strange, I can't reproduce the memory increase.
That should produce a stack of white images instead of the real slices. You could then start and uncomment from line 2169 onwards to see which line causes the memory to increase... Another thing I was thinking about: What's your model size in pixels and slices? If you slice the Eiffel tower with 0.01 mm that's 12000 slices already. If the resolution would be 1000x1000 px, that would be 1.200.000.000 bytes = 1.2 gb. If that's the case, I should really only store the slice images in a preview resolution and maybe also not store all slices if the number of slices is high... Best, |
Strange, I can't reproduce the memory increase. Another thing I was thinking about: What's your model size in pixels and Best, On 19.10.2016 21:51, Youness Alaoui wrote:
|
Yes, that makes sense, I forgot that the default layer height was changed in our version to 0.01 :
Your previous math for 1.2GB is wrong with 12000 slices, it should be 12GB, but that's assuming 1 byte per pixel, I'm going to guess that the resulting slices are not all stored as is in RAM, otherwise, it would never fit in RAM. I think the slices would need to stored temporarily in the filesystem instead, to avoid the RAM problem, also, notice how I said as soon as slicing is done, the RAM usage goes back down, so I'm guessing you don't keep the slices in memory once slicing is done ? |
Well, 12 GB is even more alarming :) Sorry for the mistake... I've just ran the Eiffel tower with the settings mentioned above. The 0.01 mm layer height really was the key: now my memory fills up almost instantaneously. Now that I've recreated the behavior you described, I see the problem: the data is indeed stored in RAM. I simply didn't think about somebody slicing with 0.01 mm which will of course create a large amount of data. But I have a solution. Once you're done with the VTK-porting stuff we can merge that and I can work on a better method to generate the slices. Also, I'll make the slicer thread run on single slices on request, not on the whole stack at once. I think the way is clear now. I'll wait for your pull request regarding the VTK-version change and start from there... |
hehe, yeah, 12GB is pretty alarming :) It might be a good temporary solution though I think. Keep the X/Y resolution, but check number of slices, if it's above 500, then change the layer height to total_height/500 and use that for the slices. Assuming a 1920x1080 full HD resolution, at 500 slices, we'd get 1920x1080x500 = ~988MB of RAM which is acceptable for a temporary solution. |
I just realized that the 3d model in the slicing tab is not actually generated from the slicing result, so it's not going to affect us. |
As mentioned in issue #4, there is a memory usage issue when loading some stl files. The one I have been using to troubleshoot the current crashes is this one : https://www.thingiverse.com/thing:912478/#files
which seems to always (or very often) cause monkeyprint to crash.
The other issue with that file (and probably others) is that as soon as slicing begins, the memory usage of monkeyprint goes through the roof. I just tried it now and as soon as I click the slicing button, the memory usage went from 200K to 4.4GB. This caused monkeyprint, Xorg, and pretty much all of my PC to freeze due to swapping. After 5 minutes, I had to ssh into the machine to kill monkeyprint so it could unfreeze itself.
The text was updated successfully, but these errors were encountered: