Comedi:Help!Memory Leak using ni_pcimio_common (NI-6533) and cmd

Hi,
I'm using the latest comedi drivers(10/14/2005) from cvs on a 2.6.11.12
linux kernel.  I have a number of issues that I need help resolving, one of
which may be a memory leak in comedi_fops.c

I start a cmd to scan (stop_src = TRIG_COUNT) 64 channels (differential
input). I get the 64 channels and than start another scan. Note also that
I'm differential, yet I have to tell it that
the number of channels to scan is 64, not the expected 32, otherwise I miss
half the data.
After a few hours my system dies with an out of memory error. Around line
902 in comedi_fops.c (do_cmd_ioctl) a kmalloc is done for
async->cmd.chanlist.  I can't find any place that this memory might be
released, and I suspect this may be the problem. but all attempts I've made
to fix it cause other troubles. Am I missing something somewhere?

If I do continous scans I don't have the leak problem, but how do I know how
many channels of data are really in the buffer when I do a read? I think
this is compounded by the fact that I'm doing differential input.  I've
found that even tho differential input is only 32 channels on this card, I
must tell the cmd structure that it is 64 channels(single ended) for
stop_src=TRIG_COUNT and for the chanlist. So I never seem to be able to
match the data to a channel. This means a read is 128 bytes per complete
acquisition, not the expected 64 bytes.

If I turn on TRIG_WAKE_EOS the majority of the time my channels are offset
by +1,I.E Channel 0 shows up in the buffer at Channel 1. but occasionally
what should be channel 0 shows up in channel 0. This happens both with
continous scans and with TRIG_COUNT scans.

I am verifying this by only having 2 channels of known data connected.

I need to fix either the single scan or the continous scan. Any help or
thoughts is appreciated.  I'll spare you sending the code, but I'm happy to
send it to anyone who can point out my problems.
-thanks any advice is appreciated...
Michael

Michael Brooks

mbrooks_at_orbitalnetwork.com
Member Technical Staff
Orbital Network Engineering
10670 North Tantau Ave.
Cupertino CA 95014
408-245-0726 - Phone
408-245-0728 - Fax

Received on 2005-10-18Z22:45:33