[sane-devel] memory problem
Thu, 14 Oct 2004 08:58:42 +0200
Hi Oliver, hi all,
On Thursday 26 August 2004 12:01, Oliver Schirrmeister wrote:
> Am Donnerstag 26 August 2004 10:12 schrieb Gerhard Jaeger:
> > [SNIPSNAP]
> > > I've linked the sane backends statically with the 'frontend'. The
> > > problem is the same. The pthread lib is linked dynamically.
> > > I've tried valgrind. That revealed only two 'real' memory leaks in some
> > > init-routines of sanei_usb, the test backend and the pthread library,
> > > nothing severe.
> > Is the sanei_usb memory-leak related to the patch you've sent me?
> > > Under control of valgrind the vm-size doesn't increase !?!
> > Hmmm, strange...
> > anybody out there with some ideas?
> valgrind supplies its own libpthread.so, probably without that bug?
> > On what box are you working? Kernel-Version and glibc Version?
> Linux version 2.4.20-8 (firstname.lastname@example.org) (gcc version
> 3.2.2 20030222 (Red Hat Linux 3.2.2-5)) #1 Thu Mar 13 17:54:28 EST 2003
> RedHat 9.0 P4-2.8, libc-2.3.2
I remember this old issue with some memory problems, when using the pthread on
linux. In the meantime I checked the sanei_thread stuff again and I noticed,
that the call to pthread_detach() is missing after the pthread_join(). This
pthread_detach() is necessary to mark the pthread resources for further usage
by next threads. As long, as scanimage is used to scan only one picture this
does not make any problems, but when using scanadf (I think Oliver did this),
the thread resources won't be freed and will eat up the memory.
The applied fix should fix this problem.
@Oliver: Could you please test with your scenario?