I need a big chunk of temporary working memory for each resident thread

a possibly similar question was discussed here In the response I provided, the links to SO topics discuss one possible method to avoid the hazard you mention: