Mempool for webcam
Description of Patch
module webcam always mallocs and frees memory for each jpeg.
this patch implements a pool for unused memory.
if memory is needed first unused memory from the pool is used or malloced
Also fixed a small bug: webcam_add_client misses new->tmpbuffer->ref++
Installation of Patch
patch < webcam.diff
Then re-build Motion and test the patch.
Change History of Patch
- 1.0 webcam mempool and small refcount bugfix
Peter , your patch seems a nice idea , but has some errors.
webcam.c: En la función `webcam_tmpbuffer_unuse':
webcam.c:99: error: structure has no member named `next'
webcam.c: En la función `webcam_tmpbuffer':
webcam.c:212: error: structure has no member named `next'
webcam.c:213: error: structure has no member named `buffersize'
webcam.c:215: error: structure has no member named `buffersize'
webcam.c:221: error: structure has no member named `buffersize'
webcam.c: En la función `webcam_stop':
webcam.c:344: error: structure has no member named `next'
make: *** [webcam.o] Error 1
So please could you fix them ?
- 11 Jan 2006
Sorry, forgot to inlcude webcam.h
Also included a patch for initialising ffmpeg_deinterlace to 0 in config.c
- 12 Jan 2006
Thanks Peter , i assume that the patch is against last daily snapshot , isn't it?
- 13 Jan 2006
I am integrating this today and will try and run with it for a few days.
If it is stable and does not leak - it will be in 3.2.5.
SVN 47 / Motion-daily 20060523
- 22 Feb 2006
I have reverted this patch. It turns out that it memory leaks. 2-4 MB in a day when you have 9 cameras.
It needs more work before we commit it again.
- 23 Feb 2006
- Now i initialize tmpbuffer->next to NULL
- log every new webcam_tmpbuffer: webcambuffer new (count %d size %d)
- log every resize webcambuffer realloc (size from %d to %d)
please give it a try an patch to snapshot motion-20060711-051001
i have 3 webcams with 4fps running and pull all the time the mjpegstreams
- 12 Jul 2006
I have attached a 24 hour statistik of my PII-233Mhz with 3 cam's at 4fps streaming.
- 16 Jul 2006
Fixed patch to work with current svn ( svn r292 ). Not tested yet with valgrind though.
- 30 Dec 2007
Update patch , fixed segfault ( double free ).
- 31 Dec 2007
Pool of memory is increasing a never is freed, so it needs a kind of garbage collector.
- 06 Jan 2008