public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Carl Karsten <carl@personnelware.com>
To: Mauro Carvalho Chehab <mchehab@infradead.org>,
	video4linux-list@redhat.com
Subject: Re: v4l2 api compliance test
Date: Tue, 04 Nov 2008 19:15:10 -0600	[thread overview]
Message-ID: <4910F39E.9060604@personnelware.com> (raw)
In-Reply-To: <1225762470.3198.23.camel@palomino.walls.org>

>>>> details: http://linuxtv.org/v4lwiki/index.php/Test_Suite#Bugs_in_Examples
>>> I'm not sure why a memory leak on abnormal termination is worrisome for
>>> you.  It looks like init_userp() allocated a bunch of "buffers", which
>>> has to happen for a program to use user pointer mode of v4l2.  The
>>> function errno_exit() doesn't bother to clean up when the VIDIOC_QBUF
>>> ioctl() call fails.  free() is only called by uninit_device().  Since
>>> the alternate flow of the program through errno_exit() to termination
>>> doesn't call free() on "buffers", you should have a process heap memory
>>> leak on error exit.
>>>
>>> Since this is userspace, a memory leak from the process heap doesn't
>>> hang around when the process terminates - no big deal.
>> Are you sure about that?
> 
> About the process heap, yes.
> 
>> if I run
>> ./capture --userp -d /dev/video1
>> VIDIOC_QBUF error 22, Invalid argument
>>
>> enough I can't run the valid modes:
>>
>> juser@dhcp186:~/vga2usb/v4l.org/examples$ ./capture --read -d /dev/video1
>> read error 12, Cannot allocate memory
> 
> The capture app would output "Out of memory" if the calloc() call for
> the --read option buffers failed.  This is some global/kernel resource
> that has been exhausted.


> 
> 
>> juser@dhcp186:~/vga2usb/v4l.org/examples$ ./capture --mmap -d /dev/video1
>> mmap error 12, Cannot allocate memory
> 
> Ditto for this.  This message can only happen at the end of init_mmap()
> when the mmap call fails.  Thus an allocation of some sort of kernel
> global resource/space failed.


so more likely a driver problem?

> 
> 
> I don't know what could be exhausting those kernel resources when using
> the userp option.  The failed ioctl()'s calls to the vivi driver would
> be a place to start looking.
> 
> 
>> although free still shows lots:
>>
>> juser@dhcp186:~/vga2usb/v4l.org/examples$ free
>>              total       used       free     shared    buffers     cached
>> Mem:       1033388     282340     751048          0      31012      98208
>> -/+ buffers/cache:     153120     880268
>> Swap:       859436          0     859436
>>
> 
> Perhaps you could look at /proc/meminfo between runs and see if
> something is gradually being exhausted.  Vmalloc address space
> exhaustion is what I'd look for.
> 

I ran this script:

http://linuxtv.org/v4lwiki/index.php/Test_Suite#memory_leak_2

and put all the meminfo's into a spreadsheet:

http://spreadsheets.google.com/ccc?key=pIfz0wOzPtW1-oZkXXbvcLA&hl=en

I don't see any columns growing or shrinking, so not sure what to make of it.

> 
> 
>>> You could
>>> equally gripe that the program didn't close it's file descriptors with
>>> the driver on errno_exit() - but process termination cleans those up
>>> too.
>> I am personally interested in anything that makes it harder for me to determine
>> if a driver is misbehaving.
> 
> Ah, eliminating unknowns.  OK.
> 

bingo.

> 
>> In addition, I would think that the API's example code should be a squeaky clean
>> example of how real code should be written, given it is often used as a starting
>> point.  If problems are identified, they should at least be noted, better yet
>> removed.
> 
> I can't say I disagree. 
> 

so assuming the problem is with capture.c, who do I tell?  (i know where to send
anything else it might be: v4l list.

Carl K

--
video4linux-list mailing list
Unsubscribe mailto:video4linux-list-request@redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list

  reply	other threads:[~2008-11-05  1:15 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-01  7:45 v4l2 api compliance test Carl Karsten
2008-03-04 14:38 ` Mauro Carvalho Chehab
2008-11-03  0:32   ` Carl Karsten
2008-11-03  1:20     ` Andy Walls
2008-11-03  3:23       ` Carl Karsten
2008-11-04  1:34         ` Andy Walls
2008-11-05  1:15           ` Carl Karsten [this message]
2008-11-07 20:56             ` Mauro Carvalho Chehab
2008-11-05  6:46           ` Carl Karsten
2008-11-05 12:17             ` Andy Walls
2008-11-07  5:43             ` Carl Karsten

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4910F39E.9060604@personnelware.com \
    --to=carl@personnelware.com \
    --cc=mchehab@infradead.org \
    --cc=video4linux-list@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox