On Wed, 3 May 2023 at 12:11, Michael J. Baars <mjbaars1977.pgsql.hackers@xxxxxxxxx> wrote:
The shared common address space is controlled by the clone(2) CLONE_VM option. Indeed this results in an environment in which both the parent and the child can read / write each other's memory, but dynamic memory being allocated using malloc(3) from two different threads simulaneously will result in internal interference.
There's an interesting note here
TL;DR: glibc malloc does not cope well with threads created with clone(). Use pthread_create if you wish to use glibc malloc.
Geoff