Giter Site home page Giter Site logo

Comments (3)

nicai0609 avatar nicai0609 commented on August 18, 2024 2

这是swig的封装的机制,查阅资料发现swig有宏定义支持不生成新线程回调:
%insert("runtime") %{ #define SWIG_JAVA_ATTACH_CURRENT_THREAD_AS_DAEMON #define SWIG_JAVA_NO_DETACH_CURRENT_THREAD %}
但经过群友测试反馈发现并不好,有时线程增长剧烈也无法释放。而且这样线程的生成和释放在一般高频下也够用,不需要考虑这个的延时。真正的高频建议还是直接用c++。
当然,如果发现有别的更好的方法能解决这个问题,欢迎讨论。

from java-ctpapi.

yellow013 avatar yellow013 commented on August 18, 2024

我之前也发现了每次回调使用新线程的问题。这个似乎是无解的,因为回调是由jni调用的,每次会new一个线程,还没找到怎么能让jni回调使用线程池的方法。jvm会回收生命周期结束的线程实例,不用担心这个问题导致jvm堆溢出,性能肯定是有影响的,但一般量化足够用,做高频不用考虑jni调用。

from java-ctpapi.

reanghect avatar reanghect commented on August 18, 2024

找到了一个解决办法,还没测试过,供大家参考。https://www.cnblogs.com/bjguanmu/p/12582258.html

from java-ctpapi.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.