Is there a way to put maximum memory usage limit on each thread in Java?

后端 未结 4 894
遇见更好的自我
遇见更好的自我 2021-01-18 13:38

When we start threads in a Java program, is there any way for us to assign memory limit to each one of them?

I mean we assign something like this for a

4条回答
  •  [愿得一人]
    2021-01-18 14:19

    In a word, no.

    There is no concept of heap memory "owned" by a particular thread.

    You can, however, tweak the maximum stack size (each thread has its own stack), but I doubt this is what you're after.

提交回复
热议问题