Safe Dynamic Library Execution and unload

Discussion in 'C++' started by Ggianks, Aug 18, 2010.

  1. Ggianks

    Ggianks Guest

    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
     
    Ggianks, Aug 18, 2010
    #1
    1. Advertising

  2. Ggianks

    Goran Pusic Guest

    On Aug 18, 5:33 pm, Ggianks <> 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.
     
    Goran Pusic, Aug 19, 2010
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?Y2luZHk=?=
    Replies:
    2
    Views:
    2,589
    Steven Cheng[MSFT]
    Jun 8, 2005
  2. Gabriel Rossetti
    Replies:
    0
    Views:
    1,326
    Gabriel Rossetti
    Aug 29, 2008
  3. Replies:
    1
    Views:
    339
    Brian Candler
    Aug 12, 2003
  4. Lothar Scholz
    Replies:
    2
    Views:
    137
    Lothar Scholz
    Mar 12, 2007
  5. John Nagle
    Replies:
    5
    Views:
    473
    John Nagle
    Mar 12, 2012
Loading...

Share This Page