-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Heavy memory and thread usage #7098
Comments
Hi @ek9852 |
Hi @dorodnic |
From memory - 2 threads per streaming endpoint (3 for D400, 4 for L500). One to memcpy frame data from USB requests, second to perform internal format conversions. 1 thread per control endpoint (2 on D400 and L500) - the camera will lock up if someone doesn't poll on interrupt endpoints. Usually the driver is handling this, but not with libusb. 1 thread for device discovery, it is created only when using pipeline or device_hub, so in a way, on demand. 1 thread for camera error monitoring. Accelerometer and Gyro each have a thread (with D435i, L515 and D455). In addition, camera specific logic is running depending on the model (things like thermal loops). |
Hi @dorodnic Are we using memory map in the v4l2 backend ? I notice that the memory map (use_memory_map is default to false). and libusb libusb_dev_mem_alloc is not used for mmap in the project. We notice a high system cpu usage (sys, not user space) on embedded device (7-8%) due to memory map is not used. Might I know that what streaming format to use for depth 16 bits only ? |
V4L2_PIX_FMT_Z16 - it is available starting from kernel 4.4. The SDK is using V4L2_MEMORY_USERPTR and not V4L2_MEMORY_MMAP. The reason, I believe, was incompatibility of memory map with the metadata patch. Regarding libusb implementation - I'm not sure what was the reason not to use it, but I do believe it was evaluated. RSUSB code is shared between Windows 7, Mac, Linux and Android and as a result may not be most optimised for each. No doubt, many things can and should be improved. However, if you are looking for tightly optimised solution for your specific platform and use-case it may be possible to get better results with custom code. The SDK is trying to address everything at once, this often creates implicit constraints that are not relevant for you. I will be happy to provide any technical information and also, we will take your feedback with the team, with regards to reducing the number of threads. |
Hi @dorodnic One quick question regarding how to enable/auto or disable the IR projector on D435. |
Laser Enabled and Laser Power are implemented as extension-unit controls.
Reference: |
Thanks. |
Hi @ek9852 Do you need further help on this? If we don't hear from you in 7 days, this issue will be closed. |
librealsense open too many threads and have large memory usage.
Tested on D435 camera , but this problem is not specific to the camera module.
My app does not create any thread (just main thread) and use librealsense.
System shows librealsense create 16 threads. and consuming > 100M bytes of memory.
We only want to get the depth frame using following codes:
rs2::frameset data = pipe.wait_for_frames();
Why it needs 16 threads in the background. In Linux each thread by default will use 8Mbytes of stack. which consume 8x16 = 128 M bytes memory already.
The tools is nice for prototype. Do we have any lite version of this library to get the depth frame only, we don't need any other heavy weight tool for running it in real production device.
The text was updated successfully, but these errors were encountered: