#Memory usage is quite high
1 messages Β· Page 1 of 1 (latest)
Please complete #938455615741775902 and someone from the community or one of our <@&938443185347244033> members will respond when they're available.
Including the meta.log from the beginning is a huge help use !logs for more information.
overlays are quite resource intensive in particular
i think i can handle it by running during the night and using swap, but i wonder if the program could be optimized to use less memory
It could be; there's been little memory-specific tuning.
It's a matter of someone knowledgeable in the area devoting time to look at it.
Im not very great with memory optimization practices
i can try having a look at it
it seems that most of the memory is used on saving the overlays in memory
since the method of operation if i understood correctly is to:
- produce all overlays for all collections
- apply all overlays to all collections
this means that all images are stored in memory until they are applied, which is not very memory efficient
it gets worse as the plex server is bigger
the overlay itself is all that should be stored
not the underlying poster
and then it should all get combined when applying
so it should be number of overlays is whats stored not number of items in your library]\
at least thats the intention
very possible i fucked it up somewhere
i dont know, if you check the html i posted (flamegraph of memory allocations) there are 384 + 380 + 380 allocations of images
that is a lot
π
maybe something that can be optimized
ok 2 things
#1 what program did you use to create the above html file
#2 can you try again with the latest nightly build i just pushed nightly140
@brave ice
https://github.com/bloomberg/memray
installed in my venv: pip install memray
run it like this: memray run --native plex_meta_manager.py -r -ov --config config.yml
i also had to do a slight tweak since pmm spawns a new python process by default which is a bit weird and these profiling tools do not work well with multiple processes
i can try with nightly yes
it was an effort to force memory clean up after each run
i see
anyways it is a simple patch just to make the profiling work properly
to generate the flamegraph:
memray flamegraph memray-plex_meta_manager.py.208534.bin
(filename will change depending on the process id)
so yea all that memory waste was due to backdrops being stored in memory which ive removed and they should now be generated on the fly
nice! i will test
and get back to you soon
ok seems to be fixed, in terms of memory usage
much better!
nice
i am getting some errors though. not sure if i was getting them before:
| Perfect Blue |
[2023-03-16 18:56:31,850] [overlays.py:362] [INFO] | cannot determine region size; use 4-item box |
[2023-03-16 18:56:31,851] [overlays.py:363] [INFO] | <class 'ValueError'> |
seems to be new, since my old logs dont have it
can you send me the full log
If you are not already in one, open a thread in #pmm-help
Find meta.log in config/logs/
Drag it in the Discord thread - the whole thing, DO NOT EDIT IT
Log file too big? USE PASTEBIN or ZIP THE FILE
Still confused? Β―\(γ)/Β―
yes
it exited early because i interrupted it since i was seeing errors
the error has little information but seems to be related to image code
btw, it seems that memray supports tracking memory with multiple processes but it needs to be explicitly defined:
memray run --follow-fork example.py (i did not test, was just curious and looked it up)
line 364 in overlays.py can you change logger.stacktrace(e) to logger.stacktrace() (remove the e) and then run again so i have the stacktrace?
ty
np
just before line 313 in the same file can you make a new line and add logger.info(overlay_image)
looks like that worked
I'll re-enable cache and do it a couple times to make sure it doesn't reapply
all good π
word
which guy
The guy who suggested closing the images in 2 places
Oh I think he abandoned PMM and wrote his own overlay script that takes negative time and memory
is that the same guy?
omg
hahahahaha
I thought that was someone else lmao
Can't recall, just bringing the COMEDY
Do you use overlays carrot?
you'd be a good guinea pig given the size of your library π
ah right
I can try the native install on this machine.
so you can't do that memthing
yes nightly π
seems to be working
atleast the error is not showing anymore, it is now saying "overlay applied (...)" which seems good
in terms of memory it also seems good
going to let the script finish executing, as it is still running
ok it has finished with no problems