martanne / vis

A vi-like editor based on Plan 9's structural regular expressions
Other
4.25k stars 258 forks source link

Memory limit for large file #897

Closed rickywu closed 3 years ago

rickywu commented 3 years ago

Can I limit memory usage when open large file? Vis is very fast so I want to use it in prod env for open large log file but with limited memory, such as docker container.

martanne commented 3 years ago

You did not mention your OS, but in general these kind of issues are best dealt with on the operating system level, not by modifying individual applications. We also use external tools (e.g. fmt(1), tr(1)) for certain functionality, meaning the restrictions should probably also apply to them.

In general vis may use lots of virtual memory, but large files are memory mapped read-only, enabling the OS to page out unused data. That is your limitation should ideally be based on physical not virtual memory. On Linux this can be configured using cgroups.