Skip to content

内存泄漏 #28

@OnlyChenDaDa

Description

@OnlyChenDaDa

Subscriber类中的take方法被interrupt异常拦截时需要再标记下interrupt,否则线程无法正常结束导致越来越多,最终结果就可能内存溢出
protected byte[] take()
{
byte[] data = null;
try
{
synchronized (lock)
{
while (messages.isEmpty())
{
lock.wait(100);
if (this.isInterrupted()) return null;
}
data = messages.removeFirst();
}
return data;
}
catch(Exception ex)
{
this.interrupt(); //需加入
return null;
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions