gpt4 book ai didi

memory - 限制 ImageMagick 内存使用

转载 作者:IT王子 更新时间:2023-10-28 23:38:10 29 4
gpt4 key购买 nike

基本上,我试图将我的 Nginx 服务器上的内存使用量保持在一定数量以下,这既是因为我疯了(据我的 friend 说),而且我想省钱。不过我担心 ImageMagick 可能会把它推到边缘。

我正在使用 -limit area 20MiB 并且我也尝试过 -limit memory 15MiB -limit map 15MiB 但是在检查进程时(因为它运行)通过top -c (with Shift-M)ps aux 它显示它使用的内存有时比我在限制中设置的要多得多。为了给出数字,它可能使用 35MB 或 40MB,而不是我期望的 20MB/30MB。我不会为 2MB 或 3MB 烦恼,但这是一个相当大的偏移量。

有人告诉我,额外的内存可能是 ImageMagick 在加载解释器等时的开销,但我对 Unix 程序不太熟悉,所以对该部门一无所知。

如果有人能解释为什么会发生这种情况,那就太好了。如果这是正常的事情,那就太好了。我只会调整一些事情以考虑到它可能会使用我的限制加上一定数量的事实,但如果不是,并且 -limit 参数不会将内存限制为一定数量,在 ImageMagick 中有这个参数到底有什么意义?

再次感谢您提前提供的帮助,一如既往地非常感谢。

最佳答案

根据文档 ImageMagick 正在将所有内存操作移动到映射文件,因此如果您有足够的磁盘空间,它将开始交换,请参阅手册:手动 -limit 中的 SNIP:

The value for File is in number of files. The Disk limit is in Gigabutes and the values for the other resources are in Megabytes. By default the limits are 768 files, 1024MB memory, 4096MB map, and unlimited disk, but these are adjusted at startup time on platforms that can provide information about available resources. When the limit is reached, ImageMagick will fail in some fashion, or take compensating actions if possible. For example, -limit memory 32 -limit map 64 limits memory When the pixel cache reaches the memory limit it uses memory mapping. When that limit is reached it goes to disk. If disk has a hard limit, the program will fail.

关于memory - 限制 ImageMagick 内存使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8700958/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com