Unable to allocate array with shape and data type

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) H100
• DeepStream Version 6.4
• JetPack Version (valid for Jetson only)
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

Hi, I am running the deepstream LPR app in python version. However, I have slightly modified it and added the crop image function using cv2 library for each of the vehicles. The app is working fine but it always will run into memory fragmentation after 1/2days running non-stop as the application keeps on writing to the memory. I understand it is a cv2 issue but are there any deepstream plugins for me to use to crop the images. Or are there any ways to solve the memory fragmentation issue.


You can refer this sample at /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-image-meta-test/deepstream_image_meta_test.c.

The nvds_obj_enc_process can encode objects into jpeg images. However, there is no corresponding python binding for this function, so you need to do it yourself.

Do you mean memory leak? You can use valgrind to check it.

Is there any way to solve memory leak issue? The issue is caused by opencv library where i convert the frame using cv.cvtColor so that opencv is able to read it

1.If you remove the crop image function, will the program still exit due to a memory leak?

2.The valgrind will indicate the location of the memory leak.

No, the crop function is the root cause of memory leak. It is caused by the line cv2.cvtColor to convert the image within the pipeline to be readable by opencv so that i can save the image down

This is a function of opencv, not related to deepstream.

In addition, please try to do some detection to analyze the problem, guessing can not solve the problem

valgrind can analyze this problem very well. You can refer to the following command line and documentation

PYTHONMALLOC=malloc valgrind --tool=memcheck  --leak-check=full  --suppressions=xxxx/valgrind-python.supp python3 deepstream_test_1.py /opt/nvidia/deepstream/deepstream/samples/streams/sample_720p.h264