Search All Forums
Dart Home | PowerTCP Winsock for ActiveX | Custom Development Reply | PowerTCP Winsock for ActiveX Topics | Forums   
AuthorForum: PowerTCP Winsock for ActiveX
Topic: Endless memory consumption

From: Durban, South Africa
Posts: 80
Member Since: 07/11/02
posted February 14, 2018 12:09 AM

Not sure if its by Dart design but if we have Dart TCP server sending data out to a TCP client (3rd party process) with Timeout=0 (i.e. non blocking), and that TCP Client is VERY slow in receiving and processing the data, then the SendBufferCount just increases, and memory is consumed because I guess the outgoing data is being buffered.

We never get the error event ptNoBufferSpace to say there is no more buffer space. Obviously a workaround is for our code to check the SendBufferCount and make sure its at least < SendBufferSize before sending but I was wondering why no error event is raised ?
Nick B (Admin)

From: Utica, NY USA
Posts: 614
Member Since: 05/25/10

Extra Support Options
Custom Application Development

posted February 15, 2018 2:32 PM


Per the Send method documentation:
If the Timeout property is positive, this method will block until the system accepts the data for sending (SendBufferCount decrements to 0) or the timeout period expires.
--Therefore when calling with timeout=0, SendBufferCount (and memory usage) can increase without restraint.

Per the SendBufferCount documentation:
When the Send method is used, some data may be stored in a buffer and later submitted to the system. The Send event fires to indicate that the system has accepted the submitted data.
...It is possible to queue up significant amounts of data by submitting large buffers; your application can adversely impact system performance by submitting megabytes of data in a short period of time.
--This is a "pre-system" buffer

Per the SendBufferSize documentation:
Number of bytes the system uses for buffering outgoing data.
--This is the system buffer

Calling Send() with a timeout of 0, when the client is not consuming the data as quickly as you are calling Send() will result in the control's internal buffer (size identified by SendBufferCount) increasing indefinitely until the data is passed onto the system (whose buffer size is controlled by SendBufferSize) until the control is notified by the system that there is available space in the system buffer. No ptNoBufferSpace error is thrown because the data was buffered internally by the control.

If you want to limit memory consumption, you should check the value of SendBufferCount before calling Send(), and don't call Send() when its value is at or over the desired memory consumption.
Reply | PowerTCP Winsock for ActiveX Topics | Forums   
This site is powered by PowerTCP WebServer Tool PowerTCP WebServer for ActiveX