From: Sam H. <she...@gr...> - 2011-06-06 13:52:35
|
We have been using SWIG with great success to wrap a c++ library and use the directors to directly subclass the callback classes in java. This works but we recently turned on "thread id" in our logger output and we noticed that every callback appears to have a new thread (as far as java is concerned anyways). We are using ASIO in the c++ library so I know as a fact that there is only one thread running in the c++ library so all calls out of the c++ code should be on the same thread. I saw the preprocessor settings SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON and SWIG_JAVA_NO_DETACH_CURRENT_THREAD but they don't seem immediately useful. It may be that this is just an artifact of the way java handles native threads but I am beginning to think a new java thread wrapper is generated for every call which may be churning alot of memory. I am using SWIG 1.3.40. Has anyone else seen this issue and if so have recommendations for how to fix it? Thanks Sam Hendley |