Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dp2OPAC 内存泄漏 #13

Open
DigitalPlatform opened this issue Jan 27, 2016 · 0 comments
Open

dp2OPAC 内存泄漏 #13

DigitalPlatform opened this issue Jan 27, 2016 · 0 comments

Comments

@DigitalPlatform
Copy link
Owner

这几天做了一次大规模的代码重构,主要是试图解决 dp2OPAC 的内存泄漏问题。

最终发现是 DigitalPlatform.LibraryClient 库中的 LibraryChannel 在通讯中等待服务器返回结果的循环中,使用了 Windows Form 下才能使用的 Application.DoEvents(),造成了 thread handle 和 ReaderWriterLock 泄露,这可能是 Application.DoEvents() 内部的代码造成的现象。

为此,修改了对 Idle 事件的使用方法,让默认情况下不出现任何对 Application.Events() 的调用。仅当 Windows Form 程序需要的时候才主动通过 Idle 事件添加这种功能。

另外,对 dp2OPAC 中所有使用 LibraryChannel 的地方,都采用 ChannelPool 来管理。不过还余下 CacheBuilder 类里面的 LibraryChannel 用法等待改造。

对全部代码中包含 AutoResetEvent 和 ManulResetEvent 的类都确保具有 IDisposeable 接口,并注意这些对象的生存周期管理。

有些担心这些修改,会令 dp2OPAC 在 SSO 情况下的功能出现 bug,需要后面补上测试。

renyh pushed a commit that referenced this issue Jun 8, 2018
DigitalPlatform pushed a commit that referenced this issue Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant