Not enough available memory to allocate a buffer for streaming when trying to give the command to start the camera.
AnsweredHello!
Because of this error:
Spinnaker: Not enough available memory to allocate a buffer for streaming when trying to give the command to start the camera.
I created the following code to attempt to release the camera:
system = PySpin.System.GetInstance()
cont = 10
while cont > 0:
try:
cam_list = system.GetCameras()
cam = cam_list.GetByIndex(0)
print(">1")
cam.Init() # ERROR
print(">2")
break
except Exception as e:
print("e: ", str(e))
if cam.IsInitialized(): # doesn't enter this if statement
cam.DeInit()
print('deInit')
del cam
del cam_list
cont -= 1
if cont > 0:
print("** Camera started **\n")
else:
print("** Camera did not start **\n")
return
However, it goes through the 10 attempts to release the camera, and then it still doesn't start. There is no specific pattern for when this error occurs. On Friday, we managed to take more than 60 photos with the camera, but today, when we tried to take the second photo, this error occurred.
Can anyone provide us with guidance on how to definitively resolve this issue? I'm beginning to suspect it's a hardware problem with the camera or something similar, but I don't know how to confirm if it's a hardware issue.
I would like some suggestions for tests to determine whether it's a software error or a hardware error.
-
Official comment
Hello Desenvolvimento,
Does it work increasing USBFS memory or using small resolution/ROI? With 20MP camera and around 500MB available memory, it could be that camera stream buffer count was very high which is stopping software to allocate enough buffer during intialization.
One thing to try is reducing this buffer count before initializing camera. Here is example code snippet that reduce buffer count to min:
# Retrieve Stream Parameters device nodemap
s_node_map = cam.GetTLStreamNodeMap()
# Retrieve and modify Stream Buffer Count
buffer_count = PySpin.CIntegerPtr(s_node_map.GetNode('StreamBufferCountManual'))
if not PySpin.IsReadable(buffer_count) or not PySpin.IsWritable(buffer_count):
print('Unable to set Buffer Count (Integer node retrieval). Aborting...\n')
return False# Display Buffer Info
print('Default Buffer Count: %d' % buffer_count.GetValue())
print('Maximum Buffer Count: %d' % buffer_count.GetMax())buffer_count.SetValue(buffer_count.GetMin())
print('Buffer count now set to: %d' % buffer_count.GetValue())
If the above approach did not work, we could do remote session to work through this together via our support ticket https://flir.custhelp.com/app/ask ?
Thanks,Ifeanyi
-
Hi Desenvolvimento,
This error means there is not enough space in RAM to allocate required buffer and start the camera. I would recommend closing some software in your pc and/or reboot system to free up space or use another pc with enough space in physical memory.
Besides, a quick check in your implementation does not seems camera list is cleared as well as releasing system instance. I would recommend referencing our example code part of spinnaker python package on how to properly implement this.
Regards,
Ifeanyi.
0 -
Hello!
We were concerned about the possibility of there being some error actually related to the computer's memory itself, so we have added this functionality for the program to display memory usage while the error is occurring, and we have not found any reason for this failure to be memory-related, considering that there would still be enough memory to continue running the program smoothly.
What other approaches do you suggest?0 -
Hello!
What camera model are you using exactly? If it is a USB3 camera, could you please check if this article helps? https://www.flir.com/support-center/iis/machine-vision/application-note/understanding-usbfs-on-linux/
Best regards,
Manuel
0 -
Hello!
Yes, it is a USB3 camera, and we have already done this, but the error persists.0 -
Hello Desenvolvimento,
What is the camera model and how many are connected to this PC? Do you see the same issue running single camera?
You may have to summit support ticket here https://flir.custhelp.com/app/ask to take a look via remote session.
Thanks,
Ifeanyi
0 -
The camera model is the Blackfly S BFS-U3-200S6C, and we have only one camera connected to the PC.
0 -
Hello!
We have already performed the requested tests, significantly reduced the image resolution, and also implemented the provided code. However, after execution, the buffer count was reduced to 1. We still encounter the same error as always.0 -
Hello Desenvolvimento,
Please open support ticket by using our contact form at https://flir.custhelp.com/app/ask to take a look.
Thanks,
Ifeanyi
0 -
To summarize the external communication for others who may have a similar issue:
- Working on a windows PC does not show any issues with the same code
- If a user is manually setting the number of user buffers, we do not recommend to use less than 3.As this works on Windows, this is likely a memory limitation on the ARM board itself. Spinnaker allocates buffers at full resolution and 24 bits per pixel, regardless of the region of interest you are using. I do not know why decreasing the number of buffers to 3 still fails, since you seem to have over 800MB free memory and 3 buffers with each taking (20MP x 3 bytes per pixel = 60MB) is less than 200MB of memory.
If others are running into a similar issue, please let us know your system specs and we can try to debug this further to find the cause.
We also changed how we allocate memory in newer spinnaker versions, so please try the latest Spinnaker available of the website to see if that behaves better.
Thank you,
Demos
0 -
Hi I'm facing the same issue. I'm running on an MacBook Pro (13-inch, 2017) 8GB DDR3 Intel Core i5.
0
Please sign in to leave a comment.
Comments
11 comments