Introduce memory monitoring in NSE
Summary: This differential introduces memory event monitoring in NSE. If critical memory event occurs we are displaying notification with current memory usage. events occurs per process and there is a proper synchronization for the memory message holder.
Test Plan:
I implemented a small function that allocates more and more bytes (200000 unsigned long) to a static array upon each notification arrival. I observed that I see memory usage notification twice since the static array is first allocated (new NSE process starts). After the second time the process was killed - I didn't see "Cleaning-up extension" log after notification display. Additionally I was logging allocated array size after each notification and after the second memory usage notification array size dropped to 200000 which means it was freshly allocated so new process was started.
I also tested whether entire notification functionality (normal notifs, rescinds and badgeonly notifs) work correctly without using memory-leak simulation function.
I tested everything on a release build connected to my local keyserver.
Reviewers: tomek, ashoat, bartek
Reviewed By: tomek
Differential Revision: https://phab.comm.dev/D8907