Safe Dynamic Library Execution and unload

G

Ggianks

Hi all,

I'm writing a program with the particul need to be able to load a
possible unstable code, wich may causes mem leaks or segfault, from
some libraries in a safe way wich preserve the program execution.

Is there a way to prevent the process to crash if a segfault occurs in
the thread that loaded the dangerous code without causing an undefined
behavior of the whole app ?

Is possible, in the same way, avoid memory leaks after the library
unload ( and thread termination, not process end ) ?


Thanks.

Regards

Gianluca
 
G

Goran Pusic

Hi all,

I'm writing a program with the particul need to be able to load a
possible unstable code, wich may causes mem leaks or segfault, from
some libraries in a safe way wich preserve the program execution.

Is there a way to prevent the process to crash if a segfault occurs in
the thread that loaded the dangerous code without causing an undefined
behavior of the whole app ?

Is possible, in the same way, avoid memory leaks after the library
unload ( and thread termination, not process end ) ?

There is no fire-proof way to get ANY of that on ANY platform I know
of, not if the code is supposed to be written "normally", that is,
using standard library, pointers, allocation facilities (new/delete)
etc.

Your best bet are platforms with good process isolation, separate
processes for "pluggable" libraries and inter-process communication to
tie all that together.

Alternatively, if you want to be safer (not safe, but safer) from
kinds of errors you note, do not use C or C++. If safety/reliability
in face of PROGRAMMING errors is your concern, C and C++ are pretty
much your worst bet.

Goran.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top