> I use a single object (lightweight) which I construct  and then just call
> its method in a loop, once for each message. If I don't use globals, use
> strict, undef $SomeVar I'm doing the right thing. All the "my" variables
> should dissapear once the method call is over.

It sounds like you're doing it right.  The lexical variables will actually
hold onto their memory if you don't undef them, but if you're re-using them
they should never get bigger than the largest value you put in them.

> But nevertheless memory goes
> on and on. Maybe this is because I tweaked vpopmail.pm (xs code) to
include
> information about user quotas which wasn't present there (perl hash) ?

Could be.  You could try commenting things out until it stops growing.

> > It sounds like you have some data structure which you are adding to and
> > never clearing out.  One thing to be careful of is the MySQL DBI driver.
> > The last time I used it, it fetched all returned rows into memory.  With
a
> > large result set, that could take up tons of RAM.
>
> I guess that DBI gets all records if you use fetchall_array|hashref and
that
> it is else OK.

No, the behavior that I saw was when fetching a row at a time.  Behind the
scenes, DBI would fetch ALL the rows into RAM and then iterate over them.
This may have been changed since then.  It was a couple of years ago.

- Perrin

Reply via email to