QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Freeing memory upon exit |
Ref. No. |
QNX.000009733 |
Category(ies) |
Utilities, Configuration |
Issue |
If the program is terminated abnormally by some error condition(e.g.SIGSEGV), the memory does not appear to be freed upon exit, or the memory becomes badly fragmented (indicated by "sin free"). Is there any way to avoid this?
|
Solution |
If able to catch SIGSEGV, deregistration with Net is not a problem. Since Net has acquired a reference to the selector, the memory will not be returned until Net also releases it(i.e. sin -P Net mem).
Do not trap the SIGKILL(must use qnx_pflags). If you do not deregister to net before exiting, Net can crash. In case that Net receives a packet of the type that is registred, it will try to call into code that is not there. |
|