Using a non-thread safe library in a NIF

I’m using a C/C++ library that is not thread-safe and requires some initialization. I’m trying to understand if I can use it safely as a nif across multiple processes, but I’m not sure of how to confirm this.

I’m thinking that if the memory allocation of the nif happens on the stack/heap of the erlang process that is calling it, that it should be fine? However, I’m not sure how to confirm this. I suppose if the library does any memory initialization, it may be outside the erlang process also.

Anyone with advice / experience on this topic? My gut instinct at this point is to make an external process that forks on each request to handle getting results from this library.