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
To place a limit on each thread you need to run each thread in a seperate process.
Threads share memory so there is no way to assign memory to a specific thread automatically. However you can do the calculations yourself in code (for each data type of interest) and manage how much memory each thread is using.