Search squid archive

Re: External C program

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Julien Philibin <julien@xxxxxxxxxxx>
> Hi, I've been trying to find a typical external ACL C program skeleton
> for a while, but I wasn't able to find anything very interesting ...
> What I would like to do, is to read to different strings and process
> them in order to allow/disallow access to a website.
> The thing is, after a while I get two processes that use around 10 Mb
> of memory and 15% of my CPU ....
> Also, if I restart squid, I'll get two more processes running and so
> on, everytime I restart squid ...

Personaly, I use fgets/fflush and I did not see any problem (memory leak, etc) so far...
Something like:

  #define INPUTSIZE 4096
  char input[INPUTSIZE];
  while (fgets(input, sizeof(input), stdin)) {
    if ((cp=strchr(input, '\n')) == NULL) {
      fprintf(stderr, "filter: input too big: %s\n", input);
    } else {
      *cp = '\0';
    }
    ...
    fflush(stderr);
    fflush(stdout);
  }

Do you use any malloc or functions that malloc... and that would need a free?

JD


      


[Index of Archives]     [Linux Audio Users]     [Samba]     [Big List of Linux Books]     [Linux USB]     [Yosemite News]

  Powered by Linux