linux - 如何使 linux swap 更急切?

标签 linux memory swap

我有一个用例,我有 5-6gb 范围内的突发分配,特别是当我在键入时 Visual Studio Code 编译我的 D 项目时。 (编译器根本不释放内存,为了尽可能快。)

DMD does memory allocation in a bit of a sneaky way. Since compilers are short-lived programs, and speed is of the essence, DMD just mallocs away, and never frees. This eliminates the scaffolding and complexity of figuring out who owns the memory and when it should be released. (It has the downside of consuming all the resources of your machine if the module being compiled is big enough.)

source

该机器是运行 Manjaro 64 位的 Dell XPS 13,具有 16GB 内存——我正在打那个屋顶。系统完全卡住,REISUB 可能工作也可能不工作,等等。我可以将它放置一个小时,它仍然挂起,不会慢慢自行解决。在我能够访问 tty 的时候,dmesg 收到了各种愉快的消息。所以我想启用一个大的交换分区来减轻压力,但它没有帮助。

我知道只有在需要时才会使用 swap,但那时已经太晚了。即使有交换,当我用完内存时,一切都会发生段错误; Qt、zsh、fuse-ntfs、Xorg。届时,它将报告典型的 70mb 交换空间正在使用中。

vm.swappiness 为 100。swapon 报告交换处于事件状态,由 systemd 自动启用。

NAME           TYPE       SIZE USED PRIO
/dev/nvme0n1p8 partition 17.6G   0B   -2

我该怎么做才能让它交换更多

最佳答案

试试这个。记得把这个问题放在 superuser 或 serverfault 中。 Stackoverflow 仅用于编程。

https://askubuntu.com/questions/371302/make-my-ubuntu-use-more-swap-than-ram

关于linux - 如何使 linux swap 更急切?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48597163/

相关文章:

c++ - 从c++运行的过程有时会丢失选项

linux - 在vi中搜索并替换以下内容

java - Android 上的性能测量

java - 为什么 Java 的 InflaterInputStream(和其他类似类)只在其内部 Inflater 上有条件地调用结束

c++ - unique_ptr 交换不起作用

linux - 如何在具有巨大 jtl 文件且具有有限磁盘空间的不同文件系统的 Linux 系统上生成 JMeter 仪表板报告

linux - 如何在网络(VPN 或 LAN)中查找已连接的主机

java - 如何解决 'java.lang.OutOfMemoryError: GC overhead limit exceeded'

c++ - 单链表交换函数(int, int)

c++ - C++ 和数组中的通用交换函数