Segmentation Fault. Failed to asign 39238144 bytes of shared memory

Hi I have been trying to use B0163 13MP camera with my raspberry pi 4. Whenever I try to capture an image using capture exe with mode 4 ( width 4192, height : 3120) I get segmentation fault. Is there anything I am missing here ?



Don’t worry and I will try my best to help you.

Have you try the smaller resolution? Please attach me your error message. Tomorrow I will help you check it in detail.

Today I have updated our lib and you can try to download it and try again. Notice to run make install .




Hi, Thanks for your response. The smaller resolution works. But I was trying to get the max resolution.

Here is the error message


Open camera... Found sensor imx135 at address 10 mode: 0, width: 1280, height: 720, pixelformat: pRAA, desc: (null) mode: 1, width: 1920, height: 1080, pixelformat: pRAA, desc: (null) mode: 2, width: 2592, height: 1944, pixelformat: pRAA, desc: (null) mode: 3, width: 3264, height: 2464, pixelformat: pRAA, desc: (null) mode: 4, width: 4192, height: 3120, pixelformat: pRAA, desc: (null) mode: 5, width: 8416, height: 3120, pixelformat: pRAA, desc: Used for Arducam synchronized stereo camera HAT, 4208x3120 * 2 index: 0, CID: 0x00980914, desc: V4L2_CID_HFLIP, min: 0, max: 1, default: 0, current: 0 index: 1, CID: 0x00980915, desc: V4L2_CID_VFLIP, min: 0, max: 1, default: 0, current: 0 index: 2, CID: 0x00980911, desc: V4L2_CID_EXPOSURE, min: 0, max: 65535, default: 1606, current: 629 index: 3, CID: 0x00980913, desc: V4L2_CID_GAIN, min: 0, max: 4095, default: 1024, current: 1024 index: 4, CID: 0x0098090E, desc: V4L2_CID_RED_BALANCE, min: 0, max: 4095, default: 1664, current: 200 index: 5, CID: 0x0098090F, desc: V4L2_CID_BLUE_BALANCE, min: 0, max: 4095, default: 1664, current: 99 index: 6, CID: 0x009A090A, desc: V4L2_CID_FOCUS_ABSOLUTE, min: 0, max: 1000, default: 270, current: 45 Please choose sensor mode: 4 Setting the mode... choose the mode 4 Current mode is 4 Notice:You can use the list_format sample program to see the resolution and control supported by the camera. Capture image mode4.jpg... Enable Software Auto Exposure... Enable Software Auto White Balance... Waiting for automatic adjustment to complete... mmal: Enable JPEG encoder.

usrvcsm: [vcsm_malloc_cache]: [9540] [mmal_vc_port buffer]: ioctl mem-alloc FAILED [-1] (hdl: 0)
usrvcsm: [vcsm_vc_hdl_from_hdl]: [9540]: invalid device or handle!
usrvcsm: [vcsm_lock]: [9540]: invalid device or invalid handle!
mmal: mmal_vc_shm_alloc: could not allocate 39238144 bytes of shared memory (handle 0) - mem (nil), vc_hdl 00000000
mmal: mmal_vc_port_payload_alloc: failed to allocate 39238144 bytes of shared memory
mmal: mmal_pool_initialise_buffer_headers: failed to allocate payload 0/1
mmal: Failed to create isp output pool.
Segmentation fault


Don’t worry, it is due to the GPU memory is not enough. Please run sudo nano /boot/config.txt

and set the gpu_mem=300. Then reboot

Let me know if you need more help.


Thanks. It worked :slight_smile:


Great to hear that.