Added the possibility to re-use already allocated memory. Used in the packet receiver.