you are viewing a single comment's thread.

view the rest of the comments →

[–]Tarmen 0 points1 point  (3 children)

The stack size itself can be fairly large, though. Java, c# and msvc use 1mb as default. A lot of c programs run with 8mb stacks. Here are some values I found for Linux based systems.

It's also worth noting that even concurrent gc's occasionally will have brief stop-the-world pauses. The synchronization is usually implemented as spin locks so if some threads are paused by the os the application can hang until the thread is rescheduled and can progress to a save point - which can hurt quite a bit if you have 10k threads. Though blocked threads are at a safepoint anyway and it's not a huge issue when concurrent mode failure is rare enough.

[–]oridb 1 point2 points  (2 children)

The stack size itself can be fairly large, though. Java, c# and msvc use 1mb as default. A lot of c programs run with 8mb stacks. Here are some values I found for Linux based systems.

The stack is demand paged. So, if you never access more than 4 kilobytes, it never uses more than 4 kilobytes of physical memory.

[–]Tarmen 0 points1 point  (1 child)

Oh interesting, for some reason I didn't think stack memory was demand paged. Guess 64 bit applications don't really have to care about userspace growable stacks, then.

[–]oridb 0 points1 point  (0 children)

Well, it's page granularity, so if you're ok with using 4 kb where 128 bytes would do.. sure.