Comments (15)
Hi there,
The registration of the callback should definitely only be done once (when you setup the camera).
The loop you are using should only be used for the actual work (image snapping, camera change, etc.).
You can of course also try to disconnect existing callbacks:
https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-handlers-disconnect-by-func
As a general approach that might help with all kinds of problems:
you can use valgrind to detect where and how a program leaks memory.
Be aware that certain libraries and programs allocate memory that makes it unclear as to how some memory is freed. Glib and therefor aravis are sadly participating in this behavior. A glib suppression file can help reduce the number of false positives.
from tiscamera.
Hi,
I use valgrind and I found a large memory leak. The log corresponding to
that part is below.
==13446== 1,226,342,400 bytes in 998 blocks are still reachable in loss
record 1,236 of 1,236
==13446== at 0x4C2AB80: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==13446== by 0x5627610: g_malloc (in
/lib/x86_64-linux-gnu/libglib-2.0.so.0.4002.0)
==13446== by 0x4E6044E: arv_buffer_new_full (arvbuffer.c:74)
==13446== by 0x402149: camera_motion (arvcameratest.c:496)
==13446== by 0x401873: main (arvcameratest.c:743)
The memory leakage increase if I increase the loop number. In the function
"camera_motion", I make the loop which the camera takes a snapshot with a
software trigger. This function is called in main function. So I guess
arv_buffer_new_full or camera_motion make the large portion of the leakage.
But I don't know how arv_cbuffer_new_full is used. Is there any possibility
that this function use the large amount of memory? Is it also related to
new_buffer_cb function?
In the camera_motion, I set the callback function for new_buffer_cb as
below.
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data);
So I try to disconnect the callback functions as below.
g_signal_handlers_disconnect_by_func(stream,new_buffer_cb,&data);
But this does reduce the leakage. I also tried "new-buffer" in stead of
new_buffer_cb but I got the same result.
How to use this function?
Cheers,
2014-12-12 18:50 GMT+09:00 Edgar [email protected]:
Hi there,
The registration of the callback should definitely only be done once (when
you setup the camera).
The loop you are using should only be used for the actual work (image
snapping, camera change, etc.).You can of course also try to disconnect existing callbacks:
https://developer.gnome.org/gobject/stable/gobject-Signals.html#g-signal-handlers-disconnect-by-func
As a general approach that might help with all kinds of problems:
you can use valgrind to detect where and how a program leaks memory.
Be aware that certain libraries and programs allocate memory that makes it
unclear as to how some memory is freed. Glib and therefor aravis are sadly
participating in this behavior. A glib suppression file can help reduce the
number of false positives.Reply to this email directly or view it on GitHub
#22 (comment)
.
from tiscamera.
Hi,
Could you show me the code of capture_motion and your loop? Maybe that can clear some things up.
Thank you in advance.
from tiscamera.
Hi,
How do I send the program? Could you teach me your email adress?
from tiscamera.
from tiscamera.
Hi,
I sent out the program to the email address which you gave me but I got the
email from the Japanese agency that they cannot take care of this problem
because original program was made by third party (ARAVIS). How should I do?
Cheers,
from tiscamera.
Hello,
did you receive a ticket number?
If you send me the ticket number I can take a look at the case.
from tiscamera.
Hi,
I didn't receive any ticket. I sent it out with the subject "Memory leakage in the program modified from arvcameratest.c" at 16:43 on 13th in JST.
Cheers,
from tiscamera.
Hi,
at first glance it seems to me that, as TIS-Edgar pointed out in his first answer, the lines 491
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data);
and 496
g_signal_connect (arv_camera_get_device (camera), "control-lost", G_CALLBACK (control_lost_cb), NULL);
are executed in a loop, thus probably leaking memory.
Are the callbacks freed up again in another part of the code that I did not see?
If not, could you put the lines outside of the loop and run the test again?
from tiscamera.
Hi,
The loop is made to handle all cameras one after another sequentially. In the loop, each camera takes a snapshot, readouts and analyzes the data.
In the callback functions,
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data)
includes the camera information in the 1st argument "stream".
g_signal_connect (arv_camera_get_device (camera), "control-lost", G_CALLBACK (control_lost_cb), NULL);
includes the information in the 1st argument "arc_camera_get_device".
So I think it's difficult to move the functions to outside the loop if I am correct. If I misunderstand, please correct me.
Cheers,=
from tiscamera.
Hi,
In that case, you could use a global variable for testing in order to check if the functions were called already.
from tiscamera.
Hi,
In that case, you could use a global variable for testing in order to check if the functions were called already.
Sorry, I could not get what you mean. Could you please explain a bit more how to do?
Cheers,=
from tiscamera.
Hi,
I've just tested if only defining the callback function, g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data), in the first loop works to retrieve from the camera buffer in the latter loop. Then I found that it is not enough. Here, I used only one camera. Below is the method that I used,
in the function "camera_motion" (see around line. 491 in cap_kt_board20141222.c)
if (call == 0){
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data)
}
call++;
"call" is defined as a global variable. In the original program, this callback function is defined every time when the camera takes a snapshot. So I changed to define this callback function only in the first loop. But this method does not work.
How should I do?
Cheers,
from tiscamera.
Hello
Sorry for the delay of my answer
I searched a little bit in the internet and found this sample:
http://code.metager.de/source/xref/gnome/DevelopmentTools/aravis/tests/arvexample.c
It looks like your sample. I guess, you used it too.
Some annotations:
As far as I know, it is totally wrong to do
g_signal_connect (stream, "new-buffer", G_CALLBACK (new_buffer_cb), &data)
more than once.
Move it out of the look you use in you main() function at while(cap_check<10){...}
The trick is setting up the Aravis library and callbacks and camera. Then you run the software trigger in the loop. If the loop has ended you clean up the Aravis and other things.
from tiscamera.
Closed since there are no more answers.
from tiscamera.
Related Issues (20)
- Black dashed lines across image HOT 5
- Can't set acquire period longer than 0.5s when capturing less than full region HOT 2
- Cannot get image/video from DFK 42BUC03 on Linux HOT 2
- ERROR tcam-libtcam timeout while waiting for new image buffer HOT 5
- Broken dependency HOT 4
- Failed to find any device to open DMK23G445 HOT 2
- Feature Requset: Callback for external trigger, before sensor read-off HOT 6
- Cmake cannot find tcam HOT 1
- PolarizedMono12Packed HOT 5
- Is there a DFK31BU camera driver available for the Raspberry Pi? HOT 7
- Intermittent failure to change pipeline state HOT 9
- Unable to use v4l2-ctl to update gain HOT 2
- Rasberry Pi 3 Arducam Day-Night Vision Camera not available HOT 1
- unable to detect camera on ubuntu HOT 5
- AttributeError: 'GstTcamBin' object has no attribute 'get_device_serials_backend' while running the 00-list-devices.py HOT 6
- support 23.04, 23.10, and 24.04 HOT 1
- Performance Variation Across Ubuntu Versions and tiscamera Package Versions HOT 4
- Is it Possible to Share a GigE Camera Feed Between Two PCs? HOT 2
- Use dfk 33ux287 tisCam code to install library fail HOT 6
- Stuck setting pipeline state to ready - pipeline.set_state(Gst.State.READY) due to TriggerMode HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tiscamera.