Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Safe Dynamic Library Execution and unload

Reply
Thread Tools

Safe Dynamic Library Execution and unload

 
 
Ggianks
Guest
Posts: n/a
 
      08-18-2010
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
 
Reply With Quote
 
 
 
 
Goran Pusic
Guest
Posts: n/a
 
      08-19-2010
On Aug 18, 5:33*pm, Ggianks <(E-Mail Removed)> wrote:
> 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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
html5lib not thread safe. Is the Python SAX library thread-safe? John Nagle Python 5 03-12-2012 04:07 PM
private data stashed in local/global execution context of PyEval_EvalCode disappears down the execution stack sndive@gmail.com Python 9 11-14-2007 10:31 PM
static library and dynamic library Even C Programming 6 10-20-2007 04:05 PM
Is an embedded ruby interpreter safe to unload Lothar Scholz Ruby 2 03-12-2007 12:05 AM
Dynamic control array loading, can't unload control/replace with o =?Utf-8?B?Y2luZHk=?= ASP .Net 2 06-08-2005 03:54 AM



Advertisments