On 27 Dec 2005 12:27:09 -0800, "bill" <> wrote
in comp.lang.c:
> Does the following constitute a memory leak?
>
> int
> main(int ac, char **av)
> {
> char *buf;
> while(1) {
> buf = malloc(BIG_NUMBER);
> execv(av[0], av);
> }}
>
> The question is motivated by the following scenario:
> I am using a 3rd party kernel module that I really do
> not trust, and it exhibits strange behavior when I use
> their free functions. Rather than trying to figure out
> the proper usage of their library
> and do things like
> while(1) {
> do_stuff(); /* should only return on error*/
> clean_up();
> }
>
> I was thinking of replacing clean_up() with
> an exec call. (Currently, the loop gets into
> a state that is clearly unhappy, and killing the process
> and restarting a new instance works to resolve
> the errors). Would replacing clean_up() with execv() be
> equivalent to killing the process and restarting
> a new instance? or will I just be masking a bigger
> problem? Clearly, the correct solution is to stop
> using this kernel module, but that is unfortunately
> out of my hands.
You're asking in the wrong place. "execv" is not a standard C
function, it is a system-specific extension. So that function, and
"kernel modules", are off-topic here.
You need to ask in a platform-specific group. Since you posted via
Google, your headers do not provide useful information. Perhaps you
want news:comp.unix.programmer or something in the
news:comp.os.linux.development.* family.
--
Jack Klein
Home:
http://JK-Technology.Com
FAQs for
comp.lang.c
http://c-faq.com/
comp.lang.c++
http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html