After doing some research I finally turn to SO to ask my question: what happens to memory dynamically allocated by a shared library (using malloc()
or new
) after the library is closed with dlclose()
? The behaviour I observed is that any access to such memory (dereferencing it, using delete
operator with it etc.) results in a segmentation fault. Is it defined somewhere?
Now it seems like a silly question to ask, when I know calling dlclose()
before I was finished with the memory was the source of the bug - triggered by using delete
operator on a new
-created object received from a shared library - I have been struggling against for the last few days, but I would like to know why, instead of just guessing in case I encounter a similar situation in the future.