Other Parts Discussed in Thread: SYSCONFIG
Dear Charles,
In the past I have had various socket issues (like the one referenced). I could ususally resolve them by using either the respective SlNet, NDK, or BSD function but all this was not logical as BSD and SlNet are just wrapper functions to the respective NDK calls and so the only thing changing is probably the memory allocation.
I have done some more debugging and noticed that all the problems I have been facing were caused by PBM_alloc function calls translating to ENOBUF or similar on a higher level. What I did to resolve was increasing the PBM Buffer in sysconfig but things got worse, i.e. more socket calls failed.

In the above image, the DNS resolver tries to get 1520 bytes for a request packet (the request is smaller but the allocation works based in maximum packet size). PBM_alloc will first check if the PBM element size is suffient to cover maxisize. If yes, it will have PBMQ_deq look for a free element in the PBM table. If there is no free element, the request will fail and produce ENOBUF in the application. However, if the packet (maxsize) is larger than then PBM element size, everything works fine as the function will reserve normal heap memory.
I have then decreased the PBM frame buffer size to 128 bytes and all the problems are gone, any socket functions however they are called are working realiably.
- Why does PBM handle try to alloc first memory within the PBM queue and then heap, does the PBM queue have any advantage compared to "normal" memory?
- Is there a reason that PBM_alloc does not have a fallback to heap in case pPkt == NULL or is it just a bug and the else in the function should be replaced by and if-statement enabling mmAlloc as fallback option?
- Having reduced the size, some (small) packets get however handled by the PBM queue (see below). What makes a packet in this queue any different from those which do not get there (and are however trasmitted or received)?

As the application is working fine with reduced PBM FB size, this is not a critcal or urgent questions but it would be useful to get some background on this to avoid potential ENOBUF errors with smaller packets and in case PBM handled packets bring any advantages for example in terms of performance.
Thank you and regards
Peter