Hi,
I am porting my C++ application from Linux/macOS/Windows to FreeBSD and there is one detail I cannot solve.
How does a C/C++ application read its current virtual memory size (for the current process)?
The application is self-monitoring and periodically checks its usage of the system. Detecting that the virtual memory size always increases without reaching a stable point is a symptom of memory leak. Detecting it before it is too late (ie. crash) allows various forms of actions or recovery.
On Linux, I parse /proc/self/stat. On macOS, I call task_info(). On Windows, I call GetProcessMemoryInfo(). I am looking for something equivalent on FreeBSD but I couldn't find anything useful so far.
Thanks for any info.
I am porting my C++ application from Linux/macOS/Windows to FreeBSD and there is one detail I cannot solve.
How does a C/C++ application read its current virtual memory size (for the current process)?
The application is self-monitoring and periodically checks its usage of the system. Detecting that the virtual memory size always increases without reaching a stable point is a symptom of memory leak. Detecting it before it is too late (ie. crash) allows various forms of actions or recovery.
On Linux, I parse /proc/self/stat. On macOS, I call task_info(). On Windows, I call GetProcessMemoryInfo(). I am looking for something equivalent on FreeBSD but I couldn't find anything useful so far.
Thanks for any info.