The following reply is IMHO just common sense.
It seems like you are using a utility intended for investigation and debugging in a production manner. I know it is very in fashion these days to try to throw mash things together this way rather than understanding your real need and writing real code. In other words, laziness. Of course this is the type of result you get. Why you think this is an issue is unclear. Can’t you just retry?
I suspect the crash comes from one of two places. It might be that the PID you are using has expired in some way, such as the process exiting or crashing, but maybe showmem does not handle this well. This would be easy to test, eg. “showmem -P 0” Another possibility is you have discovered a rare bug in showmem that shows up about once in every 600 runs. You could try to test this by repeatedly enter the command, but I think you have better things to do with your time. It could be a race condition that you can’t reproduce manually. The bug might be in the showmem program, or it might be in the get_mem_info() call. You could try to get the source from QNX, but unless you have a service contract, I wouldn’t count on it. Even with a contract, getting attention can be like pulling teeth these days.
There is however something you can do. Presumably you want to monitor the memory usage of one of your own processes. This is already a red flag, suggesting you have poorly written out of control code, but maybe you have no choice. So you can look up the API for get_mem_info() and write your own utility that you will have the source code for. If you can’t find any docs, then find out how the OS allows you to get the information you need.