In NetBSD system I am seeing this issue where top command displays -ve value for resident memory. I checked for memory leaks in code and did not find any. In fact this is the case with shell(sh) process as well [not shown in pic below].
I am curious if a bug in user program can cause this behaviour. If that is true, I wanted to understand how I may reproduce this issue.
Also if there any known bug in NetBSD or GCC library that may cause this problem.