Bill Allombert on Tue, 12 Sep 2023 14:56:20 +0200


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: threadsizemax management


On Tue, Sep 12, 2023 at 02:24:55PM +0200, Jean-Luc Arnaud wrote:
> Hi all,
> 
> I'm quite sure htreadsizemax is managed on a per thread basis, isn't?

Each threads has a separate stack which can increase independantly of the
other, yes.

> I have a script using 2 threads, and only one generates Warning: increasing
> size stack to...
> 
> So, I think it's possible to set up threadsizemax to a larger value than the
> full amount of available RAM. Am i right?
> 
> For example, I have a Mac with 64 GB or RAM. Setting up threadsizemax to 30
> GB would work as long as only 2 threads increase to 30 GB.

Yes on Linux. On Macos, It depends how Macos handles overcommit.

> What happens if a third thread tries to increase its stack? I guess this
> will generate a "Memory is full" or "No more memory available" error. Right?

Yes.

> And what if a thread terminates? Will its stack be freed, allocating more
> memory for other threads?

No. The memory for all threads is freed when the last thread end.

Cheers,
Bill