dusty-nv / jetson-inference

Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.
https://developer.nvidia.com/embedded/twodaystoademo
MIT License
7.87k stars 2.98k forks source link

GPU memory usage not restore after delete imageNet object #808

Open sky-fun opened 4 years ago

sky-fun commented 4 years ago

Hi, In my project, i found that gpu usage did not restore even though i have already delete the imageNet object. You can recurrent this by add sleep(10); downblew the LogVerbose("imagenet: shutdown complete.\n"); (line 194 in examples/imagenet/imagenet.cpp), which was after the SAFE_DELETE(net); ; And use the jtop command to monitor the gpu memory usage; When i run the imagenet sample with ./imagenet --network=resnet-18 images/jellyfish.jpg images/test/output_jellyfish.jpg, i found that the gpu RAM Legend of my device increase from 452M to 798M, and then decrease to 766M when it showed imagenet: shutdown complete.., but not decrease to 452M untill the program was ended.so i guess that the destroy() function of mEngine and mInfer did not free all the gpu it holded. So how can i free all the gpu memory usage after i delete the imageNet object?

environment of my NVIDIA Jetson Xavier NX is


NVIDIA Jetson Xavier NX (Developer Kit Version)
 L4T 32.4.2 [ JetPack 4.4 DP ]
   Ubuntu 18.04.4 LTS
   Kernel Version: 4.9.140-tegra
 CUDA 10.2.89
   CUDA Architecture: 7.2
 OpenCV version: 4.1.1
   OpenCV Cuda: NO
 CUDNN: 8.0.0.145
 TensorRT: 7.1.0.16
 Vision Works: 1.6.0.501
 VPI: 0.3.7
davidlmljll commented 9 months ago

I have the same problem, how can I solve it?