Here is an update where I am in testing right now.
Having noted that using one_event() does not cause a memory growth problem I
thought I would change Event.xs to make loop() be a while(1) loop calling
safe_one_event(). The purpose of the test was to see if that would solve the
growth problem. It would not be a solution in and of itself.
In Event.xs, I change _loop() to:
PROTOTYPE: ;$
CODE:
double maxtm = 60;
if (items == 1) maxtm = SvNV(ST(0));
while (1) { safe_one_event(maxtm);}
OUTPUT:
I thought this would be the Event.pm equivalent of doing one_event() inside
a while loop in a perl script.
I was wrong! There is still growth problems! Now I am really confused! Why
doesn't this behave the same as a script based?:
while (1) {
Event::one_event(1);
}
One work around to the growth problem is to have a timer do an unloop() and
then wrap Event::loop() in a while(1) loop. I've done this with a timer
interval of 5 seconds and the growth seems to end. While not an answer, it
is a way to work with the current Event.pm/perl problem and solve the growth
problem with minimal pain. Depending on the application a larger interval
could also be used.
To do this, one would add the following to their script:
Event->timer(interval => 5, cb => sub{unloop;});
then change their Event::loop; line to
while (1) {
Event::loop;
}
Brad