adding reentrant fun of memory.c is done. nqueen_r is tested and works well. The problem was open_descriptor_in -> caml_alloc_channel_r -> caml_alloc_custom_r -> caml_alloc_shr(non-reentrant old heap)
freelist reentrant version. nqueen_r works well