On Saturday, 8 February 2014 at 11:15:31 UTC, Jakob Ovrum wrote:
However, if this one allocation really is a problem, you might
want to implement a simple free-list kind of allocator to
allocate from. Say, pre-allocate N string buffers with M length
and treat them as a free-list. If the free-list is full (all N
buffers are being processed), wait until there is a free space
before reading another datagram from the socket.
This makes program performance deterministic depending on the
worst-case complexity achieved when allocating from the
free-list. GC cycles are never run if the program doesn't
allocates GC memory.
Meh, it sounds rather ghastly. Perhaps if I periodically call
GC.collect instead I can keep it down to a manageable delay.