Slowdown is one reason, interfering with code is another.

On unixen, it installs/uninstalls a SIGSEGV and a SIGBUS handler every
time you invoke a native function or do memory copies, basically
anything that might touch native memory.

Some native code (possibly the jvm itself) uses SIGSEGV for its own
purposes, so leaving it hooked all the time is probably not good.

Its also not thread safe - it currently uses a global jmp_buf to
recover from segfaults, so if two threads are executing native code
and one of them segfaults, it could jump back to the wrong context.

On 20/01/2008, Thomas E Enebo <[EMAIL PROTECTED]> wrote:
> I have not noticed it before.  I wonder why it is not recommended for
> anything but testing/debugging?  Perhaps it slows things down in some
> way?
>
> -Tom
>
> On Jan 19, 2008 4:27 AM, Charles Oliver Nutter <[EMAIL PROTECTED]> wrote:
> > I just noticed this in JNA...could be new?
> >
> > setProtected
> >
> > public static void setProtected(boolean enable)
> >
> >      Set whether native memory accesses are protected from invalid
> > accesses. This should only be set true when testing or debugging, and
> > should not be considered reliable or robust for multithreaded
> > applications. Protected mode will be automatically set if the system
> > property jna.protected has a value of "true" when the JNA library is
> > first loaded.
> >
> >      If not supported by the underlying platform, this setting will have
> > no effect.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
>
>
> --
> Blog: http://www.bloglines.com/blog/ThomasEEnebo
> Email: [EMAIL PROTECTED] , [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to