Hi Teemu, On Nov 18 23:28, Teemu Nätkinniemi wrote: > Hello! > > I raised this issue couple of years ago on cygwin-developers.
The cause of the problem is well known for a long time. The underlying dlmalloc implementation was never developed for threaded processes, and Cygwin was originally not multi-thread capable so that wasn't much of a problem. Since that time, Cygwin has moved to multi-threading but we still use dlmalloc under the hood. The simple approach of just adding a lock to each call into dlmalloc (see winsup/cygwin/mm/malloc_wrapper.cc) avoids crashes, but leads to congestion in processes using lots of memory allocation in lots of threads. This is aggravated by the fact that we use malloc within Cygwin itself. There were a couple of efforts over the years to replace dlmalloc with, for instance, ptmalloc3, or to convert dlmalloc to the USE_LOCKS variant. For some reason or other, none of these efforts where ultimately fruitful yet. Personally I have to admit defeat in trying to get ptmalloc3 running, more than 10 years ago. Anyway. Having said that, anybody being able to come up with a malloc port which actually works as part of Cygwin *and* avoids the contention of the current solution will get as many goldstars and plush hippos (see https://cygwin.com/goldstars/) the person asks for. Corinna