I have an application where i am receiving / synthesizing data from a number of sources. One source is UDP packets. From what I can find, the only way to receive data from a
sock = UDPSocket() is with
recv(sock)… which returns a freshly allocated array.
I am receiving packets quickly, so this ends up being a lot of allocations. Timeliness is important, so I don’t want to be constantly triggering garbage collection (not sure how to profile the impact of that). Is there no way to get the data from a UDPSocket into a pre-allocated array? The packets are all the same size.