I want to change WICED_ALLOCATE_PACKET_TIMEOUT from 2000ms to 20000ms (from 2sec to 20sec).
It looks like you are hitting OOM issue. You need to analyze the memory usage in your application. I don't think increase WICED_ALLOCATE_PACKET_TIMEOUT helps. (Keep retry allocating memory for 20 sec is not a good idea.)
This behaviour appears when I transmit UDP packets to a specific Android device that lacks some UDP packets. I deduce that the WiFi transceiver tries to retransmit WiFi packets so many times that packet pool overflow.
The rate that I produce UDP packets is 60Packets/s. Every packet is 1KByte.