Tags: darkwisebear/gosnmp
Tags
Optimize memory usage. If aggregating results from thousands of GetNext() calls in memory, the runtime seems unable to release some of the memory allocated by send() (or dispatch() now). The situation can be improved by copying the r 8000 esliced response slice in dispatch(), rather than having the runtime keep a reference to a larger (and partially usefull) buffer array. This is the bug I was trying to squash in b84d786. The logic of adjusting the buffer size dynamically seems to be still valid though. With this change, the actual buffer size allocated to handle the response is no longer a problem so I changed the rxBufSizeMin and rxBufSizeMax to more aggressive/generous defaults (and min buffer size is proportional to request size). This will probably make buffer resizing an exceptional event.