Code Monkey home page Code Monkey logo

Comments (4)

winddriver avatar winddriver commented on May 28, 2024

在 _ListenSocket := nil; 前面先调用 _ListenSocket.StopLoop;

from delphi-cross-socket.

gmxyb avatar gmxyb commented on May 28, 2024

谢谢。我试过StopLoop,还是会随机出现不能释放。
Create 时自动 StartLoop,但是销毁之前却要手动 StopLoop,这里样的设计是否合理?

from delphi-cross-socket.

pony5551 avatar pony5551 commented on May 28, 2024

感觉是接口的坑,最好是可以改为对象池管理对象,我也发现过类似问题。

而且关闭服务器时,会有线程数的accept对象不会被释放,
发现这个是强行退出io都会这样,只有把对像管理起来才能解决这个问题

from delphi-cross-socket.

winddriver avatar winddriver commented on May 28, 2024

因为你要是不调用StopLoop,IO线程就不会退出,IO线程有对ICrossSocket对象的引用,所以必须在退出之前调用StopLoop才行,你直接 _ListenSocket := nil 只是减少一次对象的引用计数而已,并不能释放接口对象,接口对象只有在引用计数减到0时才会被释放,这是接口的基本特性。

from delphi-cross-socket.

Related Issues (20)

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.