Member-only story
How much memory is using a “thread”, based on the programming language
Keep in mind those are the defaults, and can be changed with the proper flag
First off, The amount of memory that a thread uses depends on a number of factors
- The size of the thread’s stack. The stack is used to store local variables, method parameters, and return addresses. The default stack size varies depending on the programming language and the operating system.
- The objects that the thread references. Objects are stored in the heap, which is a shared memory space that all threads access. The amount of memory used for objects depends on the size and number of objects that the thread references.
- The operating system. The operating system may also allocate some memory to each thread, such as for thread control blocks.
In general, a thread will use at least 1MB of memory, but the actual amount used can be much higher, depending on the factors listed above.
Programming language memory usage map
const programmingLanguageDefaultStackSize = {
Kotlin: "1MB",
JavaScript: "1MB",
Golang: "2MB",
C: "8KB",
Cplusplus: "8KB",
Java: "1MB"…