Decrease Jetson/Ubuntu RAM usage of C++/OpenCV app probably because of "dnn::Net.forward()" function call

Job ID: 34912811

Budget: €12 – €18 EUR

C++ and OpenCV 4.4 app (that tracks and counts people/objects)) running inference at Nvidia Jetson Nano consumes cca. 1 GB of memory.
I need this usage to be at least 50% less.
The very same app under any Windows PC (desktop or mini) has acceptable RAM usage of 150 MB.
On Jetson Xavier NX it is even higher: 1.5 GB (same code)!!

From my experiments I found out that the following code line is responsible for such consumption:
//INTRODUCTORY DECLARATIONS:
cv::dnn::Net net = dnn::readNetFromCaffe( paths )
net.setPreferableBackend(dnn::DNN_BACKEND_CUDA);
net.setPreferableTarget(dnn::DNN_TARGET_CUDA);
vector<cv::String> outNames = net.getUnconnectedOutLayersNames();
vector<Mat> outs;
////THIS LINE SENDS RAM USAGE HIGH:
net.forward(outs, outNames);
(e.g. when it is commented out: RAM drops to only 60 MB but then no inference of course)

JetPack ver = 4.4 (CUDA ver = 10.2)
Related categories: CUDA OpenCV