Re: pear::HTTP_Request and pear::Net_Socket
| From: | Ryan Escarez | Date: | Fri, 21 Apr 2006 11:19:55 +0000 |
| Subject: | Re: pear::HTTP_Request and pear::Net_Socket | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23793@lists.php.net to get a copy of this message | ||
On 4/18/06, Justin Patrin <papercrane@gmail.com> wrote:
> On 4/17/06, Ryan Escarez <ryan.escarez@gmail.com> wrote:
> > On 4/18/06, Justin Patrin <papercrane@gmail.com> wrote:
> > > On 4/17/06, Ryan Escarez <ryan.escarez@gmail.com> wrote:
> > > > Hi,
> > > >
> > > > I'm using pear::HTTP_Request and I'm having difficulty gaining memory
> > > > that already used by pear::Net_Socket. I got the following error after
> > > > running my script
> > > >
> > > > <b>Fatal error</b>: Allowed memory size of 8388608 bytes exhausted
> > > > (tried to allocate 4097 bytes) in
> > > > <b>/usr/share/pear/Net/Socket.php</b> on line
> > > > <b>243</b><br />
> > > > Allowed memory size of 8388608 bytes exhausted (tried to allocate 0 bytes)
> > > >
> > > > Is it possible to free up memory that already used by
> > > > pear::Net_Socket? I've tried checking on how many memory it consumed
> > > > and i found out that after doing a 20,000 pear::HTTP_Request loop, it
> > > > eats almost 8MB of RAM on 50% or 10,000 pear::HTTP_Request loop only
> > > > and the script stop. AFAIK increasing 8MB memory limit is not
> > > > advisable. Any idea or workaround on this?
> > > >
> > >
> > > I suggest trying to figure out where the memory leak is. Perhaps you
> > > should try unsetting your variables and see if that helps any. As a
> > > workaround you could always do less requests per script run.
> > >
> > > --
> > > Justin Patrin
> > >
> >
> >
> > Hi Justin!
> >
> > Thanks for your suggestion, I already did unset() and
> > mysql_free_result() but neither of them had free up the already used
> > memory. Do you think this is a bug on pear::Net_Socket?
> >
>
> It could be. It could also be that the socket library in PHP has a
> memory leak. Perhaps try a different/newer version of PHP?
>
> --
> Justin Patrin
>
Hi Justin,
I tried your suggested workaround and it ends me up on cheating the
PHP on memory limit of per script run. I just did an offset and
max_rows per script run and once the batch is done I just summon
another one to continue the processing... and so on... This technique
is just a temporary until I haven't find a good one to solve the
issues.
Thanks again Justin!
--
Ryan Escarez
CEBB F1E4 1E39 EC48 F05D 6B72 9C11 DD88 5E39 E471
$ gpg --keyserver pgp.mit.edu --recv-keys 0x5E39E471
main(k){float i,j,r,x,y=-16;while(puts(""),y++<15)
for(x=0;x++<84;putchar(" .:-;!/>)|&IH%*#"[k&15]))
for(i=k=r=0;j=r*r-i*i-2+x/25,i=2*r*i+y/10,j*j+i*i<11&&k++<111;r=j);}