Subj : Re: pthread_create and memory To : comp.programming.threads From : Marcin 'Qrczak' Kowalczyk Date : Tue Mar 15 2005 11:51 am Marcin 'Qrczak' Kowalczyk writes: > With the current 128kB default of the global young heap there is an > awfully lot of minor GCs. They are very fast: in the current design > the cost of GC is proportional to live data, and the design of my > language and some properties of its implementation yield much > short-lived data. > > If this had to iterate over all threads and ensure that they are > safe, and this happened several times a second, half of parallelism > would be thrown out of the window. Concrete numbers from running the compiler on a large file (the compiler is written in a functional style and has several passes which allocate new data based on case analysis of previous data): Running time: 2.9s Percentage of time spent in GC: 10% Total garbage collections (minor and major): 1442 Major garbage collections: 3 (including one added at the end for stats) Maximum memory in use at a single point of time: 8MB of live data Total memory ever allocated: 188MB Memory moved by the copying GC: 33MB It only uses a single thread. But in a MT program with many threads, if one thread performed work similar to the work of the compiler, letting all threads stop in a safe place 500 times a second would be disastrous. -- __("< Marcin Kowalczyk \__/ qrczak@knm.org.pl ^^ http://qrnik.knm.org.pl/~qrczak/ .