in reply to Memory Leak with XBase?
As a general rule, don't use "new" in a loop unless you want to keep them. For instance, in your code I would do something along the following:
That way you are reusing your $table object, instead of wastefully creating new ones for each pass.my $dbname = "dbname.dbf"; my $table = new XBase "${dbname}") || die; while(1) { for my $i (1 .. 100) { #pseudo code $table->empty; $table->read($_); $table->display; } sleep(2); } $table->empty;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Memory Leak with XBase?
by tigervamp (Friar) on Mar 19, 2004 at 17:15 UTC |