高速率数据流和内存不足
我有一个程序,可以以 800 Mb/s 的速度累积来自网络接口的流量。该程序由Delphi开发,同样是32位平台(Delphi不支持64位架构)。 我正在内存(RAM)上写入接收到的日期,一段时间后(未知,取决于接收到的数据),将接收到的数据块(未知大小,取决于接收到的数据)写入硬盘并释放内存(RAM) 。
当我运行该应用程序时,一段时间后,它会抛出“内存不足”异常。我应该怎么做才能防止这种异常?
I have a program that accumulates traffic from network interface in 800 Mb/s. This program is developed by Delphi, also in 32bit platform(Delphi does not support 64bit architecture).
I'm writing received date on the memory(RAM) and after a while (unknown and depends on received data), write a block of received data (unknown size and depends on received data) into hard disk and free the memory(RAM).
When I run the application, after some times, it throws "Out Of Memory" exception. What should I do to prevent this exception?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个非常高的数据速率 - 我假设它是兆位(100 兆字节/秒)。只有最快的 SSD 才能跟上,而且前提是您的编程效率为 100%。检查顺序写入速度表:http://www.anandtech.com/storage/showdoc.aspx?i=3702&p=9" rel="nofollow noreferrer"> anandtech.com/storage/showdoc.aspx?i=3702&p=9
如果您可以投入更多 RAM 来解决该问题,我建议您进入 64 位模式并一次性分配整个 RAM 缓冲区。
That's a very high data rate - I assume it's Mbits (100 MBytes/second). Only the fastest SSDs will be able to keep up, and that's only if your programming is 100% efficient. Check the table of sequential write speeds: http://www.anandtech.com/storage/showdoc.aspx?i=3702&p=9
If you can throw more RAM at the problem, I'd suggest going to 64-bit mode and allocating your entire RAM buffer all at once.