Reply to topic

Memory used just grows despite reduction of layer / effects.

Pixel_Freak
Registered Member
Posts
10
Karma
0
I'm having a problem with the memory used by files, it grows to the point where it starts Swapping, exporting it as a .psd and loading that seems to fix the issue, bringing 8 GiB used down to around 1 GiB, but it's annoying losing layer and comps setups.

My process is layer, group, inherit transparency and merge heavy, i don't know if that has anything to do with it.

Any ideas how how to work around this other then the whole exporting as .psd thing.

Any suggestions would be greatly appreciated.
ahabgreybeard
Registered Member
Posts
791
Karma
7
OS
Why are you exporting as a .psd? What happens if you Save it as a .kra file then restart krita and open it?
How does the RAM usage compare to the image size as given on the status bar?

If you're doing lots of Group/Layer Merge actions, that reduces the image size but the original layers are stored in RAM in case you decide to Undo the merge operations later. In Settings -> Configure Krita -> General -> Miscellaneous, you can try reducing the size of the undo stack to see if that helps. I don't know if that can be done 'live' and it would be better to Save your work first then reduce the stack size and restart.

If you can reduce your image size to 50% then that will reduce your RAM usage to almost 25%. (Maybe try reducing it to 70% size to get RAM down to around 50%.) Similarly, if you're using 16-bit precision, that will double your image size compared to using 8-bit precision.
Pixel_Freak
Registered Member
Posts
10
Karma
0
"Why are you exporting as a .psd?"

Loading a saved .kra before I export:

Image size: 6.8 GiB
-layers: 3.9 GiB
-projections: 2.8 GiB
-instant preview: 0 B

Memory used: 6.0 GiB / 7,3 GiB
image data: 5,9 GiB / 7,2 GiB
pool: 74,0 MiB / 74.0 MiB
undo data: 0 B

Swap used: 2.8 GiB


Loading the .psd After I export.

Image size: 433,4 MiB
-layers: 278,7 MiB
-projections: 154,6 MiB
-instant preview: 0 B

Memory used: 516,3 GiB / 7,3 GiB
image data: 5,9 GiB / 7,2 GiB
pool: 74,0 MiB / 74.0 MiB
undo data: 0 B

Swap used: 0 b

"What happens if you Save it as a .kra file then restart krita and open it?"
Nothing happens, the old memory usage gets loaded with the file.

I'm already using using 8-bit precision, and I can't reduce the resolution as I'm working at 2x final.
User avatar boudewijn
KDE Developer
Posts
4632
Karma
19
OS
Then I suspect that some of your layers have a lot of data outside the canvas area. Use trim to canvas size from the image menu to test that hypothesis.
Pixel_Freak
Registered Member
Posts
10
Karma
0
Cropping doesn't seem to work, and if that was the problem I wouldn't expect the .psd export to fix it as it keeps the stuff that is outside the canvas.
User avatar boudewijn
KDE Developer
Posts
4632
Karma
19
OS
Crop? I did not say crop, did I? I said "use the trim to canvas size" option from the image menu. And when Krita saves to psd, as far as I know, it only saves pixel data inside the image boundaries.
Pixel_Freak
Registered Member
Posts
10
Karma
0
Sorry, I meant I used Trim, and I just tested exporting a .psd with stuff outside the canvas and form what I see it is kept.

This is a problem I have with all files I work on, not just the one I'm working on right now.
User avatar TheraHedwig
KDE Developer
Posts
1713
Karma
10
OS
hm... The only thing I can think of at this point is that kra stores stuff that the psd doesn't. Can you make a sample file so we can see where the bottleneck is? Maybe it is a bug instead!
Pixel_Freak
Registered Member
Posts
10
Karma
0
I might have tracked down the problem, the way I fill Is using the Inverse "Contiguous Selection Tool" (Selection Tool + Alt) and filling the resulting selection, this seems to fill the Layer with transparency making it the size of the Image, and the transparent pixels gets coped way with the .psd export.

The same seem to happen with filling with the Alpha Lock on.
Pixel_Freak
Registered Member
Posts
10
Karma
0
Replicating the problem.

Make a File that is 4k (or larger).
Draw a tiny dot, and turn alpha lock on.
Duplicate layer a bunch of times
Go over the layers Filing the opaque pixels using "Fill with Foreground Color". (The also seems to happen with the Fill Tool. but with an unpredictable alpha area)

And watch the memory use skyrocket.

Quick and dirty workaround (not as good as the .psd):
put everything in a group, use the Transform Tool to nudge the group, this seem to update the layers and get rid of some of the superfluous fully transparent pixels

In the end the issue seems to be Krita not culling the fully transparent areas of a layer (or it might be on my end as I have not found anybody with the this problem using google ).
ahabgreybeard
Registered Member
Posts
791
Karma
7
OS
I've just tried that with a 1024 x 1024 image with a tiny coloured dot in the middle of layer 1, then alpha locked. This gave a 4MB image size. I duplicated the layer 11 times and selected each layer in turn and did Edit -> Fill With Foreground Colour. Image size went up to 51MB and RAM used went up to 101MB. That is not a lot.

I'm using a recent Linux appimage. Which OS and krita version are you using?
Can you Save an example of an image where memory use has 'skyrocketed' and provide a link to the .kra file?

For your original file, what was the image size in pixels and roughly how many layers did you have in it?
Pixel_Freak
Registered Member
Posts
10
Karma
0
The resolution i work at is 3000 x 2000 pixels and I'm I use around 150 to 250 layers,, I work with Cut Out Animations so I can't cut down on the number of layers or resolution (this is not a problem with a single file I have this problem with all my Cut Out Animation files).

Os is Win 7 and Krita version is 4.1.7.

Having the 100% transparent areas culled by the .psd export takes my file size form 7 GiB down to under 1 Gib, the Transform Tool down to around 3 GiB,
so I belie the issue is pore Culling on Krita's part.
ahabgreybeard
Registered Member
Posts
791
Karma
7
OS
When you say "... takes my file size form 7 GiB down to under 1 Gib.", I assume you mean the 'image' size in RAM. The 'file' is what is stored on your hard drive and is probably much smaller.

Also, did you try reducing the Undo Stack size, like taking it down to 1?

If you're doing animations, how many of those 150+ layers are animated and how many frames do they have?

The .psd file format can't store krita animations so I'm very puzzled about how you're doing this with animations. If you save a krita animation in .psd format, you'll loose all frames after being warned that you'll loose animations and the .psd file will be notably smaller and will of course use much less RAM when opened in krita.

I tried your guide for "Replicating the problem" and got nothing unusual. So can you make a sample file that shows the "memory use skyrocket" and post a link to it and tell us the RAM usage you have with it? If you don't have Dropbox etc, you can use https://uploadfiles.io/ which has a free unregistered service (30 days max storage).

Until you provide a representative sample file, this all just becomes more puzzling.
Pixel_Freak
Registered Member
Posts
10
Karma
0
I'm using Spine for the animation and producing the Cut Out parts in Krita, so there is no animation in Krita.

https://ufile.io/03n9dzvb
The Red dot has been just draw and the Blue has had a fill operation applied to it.
If you take a look at the layer preview you should see the layer size of the Blue layer is that of the image size, and the Red is more constrained around the actual red dot.
If you duplicate the Red layer you should see a negligible increase in memory use, but duplicating the the Blue layer the memory use should start to pile up.

The problem seems to be that the Fill operation fills the entirety image size, making the Layer size that of the Image size, rather then the just having it fill what you have selected or alpha lock pixels.
This happens with the Fill regardless if your filling a selection, alpha lock layer or contiguous pixels.
the Gradient tool dose not do this with selection, but dose do it with alpha looked layers.

Transforming, resizing the image and .psd export seem to update the Culling of transparent pixels making the layer size fit closer around the opaque parts of the layer, reducing the memory use for the layers.
ahabgreybeard
Registered Member
Posts
791
Karma
7
OS
Thanks for providing that sample file.

Duplicating the Blue layer certainly does make RAM use 'skyrocket' but I found that it doesn't show in the status bar until you Save the image then Quit and reopen the file.

Some numbers: Original file: Image = 124MB, RAM = 187 MB
10x Duplicate Red layer gives: Image = 125MB, RAM = 192MB
10x Duplicate Blue layer gives: Image = 792MB, RAM = 1.4GB

If you save as a .psd file then open the .psd file, you get a massive reduction in RAM (but you lose the alpha locking as might be expected).

Original as .psd file: Image = 384kB, RAM = 672kB

If you then Save that as a .kra file and Quit then open it you get Image = 384kB, RAM = 1.3MB

This needs a Krita Developer to consider and comment.

EDIT: P.S. I notice you uploaded a .rar archive and the .rar is 59.3KB and the .kra file content is 1.6MB

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], baxksterjohnmoli, Bing [Bot], Google [Bot], Majestic-12 [Bot], Snudl, Sogou [Bot]