There are several questions on here regarding how to set a limit on a process's memory consumption. I have recently learned about demand paging, and my question is why it would be useful to set such a limit.
As I understand it, if Process A is using a lot of memory and some other Process B needs more memory than is available, some portion of Process A's memory (e.g. some number of pages it is using) can be swapped to disk so that Process B can swap in some pages assuming A and B don't need the memory at the same time.
(obviously this is a simplification but I think it has the relevant details for this question)
If this understanding is generally correct, then what is the benefit of setting a limit on the virtual memory used by Process A? Is it just to limit the amount of swap space that could end up being used by Process A? Isn't virtual memory in a sense "infinite" due to demand paging?