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

(TBufferObj*)m_phBuffer.Alloc(sizeof(TBufferObj) + m_dwSocketBufferSize, HEAP_ZERO_MEMORY); 大量并发情况下,分配内存失败导致应用崩溃 #7

Closed
ckcfcc opened this issue Mar 20, 2015 · 2 comments

Comments

@ckcfcc
Copy link

ckcfcc commented Mar 20, 2015

在一个进程中开启了2个TcpServer,用于做代理转发。

一个端口为5678,设置为可接受10个连接
一个端口为6789,设置为可接受20000个连接

DEFAULT_FREE_BUFFEROBJ_POOL,和 DEFAULT_FREE_BUFFEROBJ_HOLD 使用的默认值

将6789端口接收到的所有包转发连接5678端口的所有服务器上。

客户端压力反复断开和连接,每次连接成功后,会发送大概500字节的包后,自动断开,然互重连。

6789端口的连接一直保持在3000以内,大概5~10分钟,就会发生 私有堆 无法分配的情况,即:
(TBufferObj*)m_phBuffer.Alloc(sizeof(TBufferObj) + m_dwSocketBufferSize, HEAP_ZERO_MEMORY) 返回为nullptr

如果6789端口只是接收,但并不通过 5678 转发,则不会出现此问题

@ckcfcc
Copy link
Author

ckcfcc commented Mar 20, 2015

补充一下,是2台机器进行的一个测试。

如果是本机,不太容易出现

@ldcsaa
Copy link
Owner

ldcsaa commented Mar 30, 2015

应该是你的程序分配了内存或创建了连接没有释放了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants