Re: [nativelibs4java] Segmentation faults when callbacks are garbage collected

27 views
Skip to first unread message

Olivier Chafik

unread,
Feb 6, 2013, 7:07:40 AM2/6/13
to nativel...@googlegroups.com
Hi Johannes,

The FAQ is the place you're looking for :-) (updated with a word on callbacks)

As for the callback thingie, I can't see anything sensible to do about it (we just can't replace references in native code that point to a GC'd callback by a fallback callback :-S).
Setting the protected mode might or might not help here...

Cheers


2013/2/6 Johannes Rudolph <johannes...@googlemail.com>
Hi,

I'm getting segmentation faults with BridJ when my Java callback instances are GC'd and afterwards accessed from native code. I understand that I have to guard my callbacks against GC but must the native callback wrapper seg fault in such a case? Couldn't it just throw a fatal exception explaining the issue (fatal because the native caller of the callback won't be able to recover from such a condition in general)? 

And related: Is there a wiki page listing potential developer errors you may have when using BridJ and their symptoms and possible solutions? Like the callback case or e.g. in which cases you may be risking buffer overflows and similar.

Johannes

--
You received this message because you are subscribed to the Google Groups "NativeLibs4Java" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nativelibs4ja...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages