Closed nstwfdev closed 2 months ago
I've looked into this a bit, and an increase in memory usage, up to multiple tens of megabytes is unfortunately unavoidable at the moment. One cause for this is the scraper that loads website titles and descriptions when adding bookmarks. It uses the charset_normalizer
library for detecting an appropriate encoding for the website, and the library creates extensive caches for what it needs to do. I could not find an alternative that would reserve less memory in my short investigation.
Another thing that I ran into when testing locally is that the process memory never decreases, even though objects seem to be dereferenced. Not sure if that is how Python is supposed to behave. Anyway, if someone is up for debugging this in more detail that would be appreciated.
Not sure if related, but similar problem for me with docker image latest version. I start a container on my laptop and everything just freezes.
Sounds more like https://github.com/sissbruecker/linkding/issues/453
I've been doing some more testing related to memory usage lately and could not observe a memory leak. The app will take up some more memory at runtime, but it does not look like it keeps growing.
Reasons why linkding takes up more memory after running for some time:
charset_normalizer
as explained aboveAnother reason why memory usage for Docker containers can grow is due to the Linux system caching accessed files. As long as the host system provides more memory, and the Docker container does not have an explicit memory limit, the system in the container will keep using that available memory from the host for caching. In general linkding does not access any huge files, but this can become noticable when creating or viewing HTML snapshots, as those can take up several megabytes.
For an installation of the base image, memory usage should hover around what is shown in the OP, so somewhere around 230 MB. For the plus image you should plan with around 1 GB of available memory, in order to be able to run Chromium when creating HTML snapshots.
Hello there. Finded already existing issue https://github.com/sissbruecker/linkding/issues/488#issue-1760278070, but it closed, reopen.
Started from 180mb. But after ~10-12h,
docker stats
said:20d8cd58d036 linkding 0.01% 232MiB / 31.29GiB 0.72% 867kB / 2.16MB 0B / 0B 13
docker-compose.yml
.env