Giter VIP home page Giter VIP logo

Comments (13)

ooking avatar ooking commented on July 26, 2024 1

还有一个注意的是
$ql = QueryList::getInstance();
之后
记得不要用静态方法来调用例如:$ql::html($html) 否则内存爆了还是会出错
都得改成 $ql->html($html)

from querylist.

windpursuer avatar windpursuer commented on July 26, 2024

隔20秒左右就会出现一次,每次ID不同

from querylist.

windpursuer avatar windpursuer commented on July 26, 2024

有人可以解疑吗?

from querylist.

mountainguan avatar mountainguan commented on July 26, 2024

我也遇到一样的情况,不知道问题是什么产生的,每次执行完都销毁了

from querylist.

jae-jae avatar jae-jae commented on July 26, 2024

我需要一份能重现这个错误的代码来做分析,可以加QueryList交流群,然后私发给我

from querylist.

mountainguan avatar mountainguan commented on July 26, 2024

我知道怎么解决了,应该是因为循环调用静态的QueryList,但是每次调用的静态get方法都会创建新的phpQuery对象,导致积压在内存中,内存爆了,就存不了新爬到的内容。
(destruct方法不能回收对象资源,只能去掉不必要的旧html缓存,这个问题应该需要解决一下,毕竟querylist全都是静态方法,会常驻内存,但是每次调用的phpQuery却又是重新创建一个。)
解决方法,只初始化一个$ql = QueryList::getInstance(); ,后面就一直用这个对象,刚刚爬了几百个页面都没事,之前爬50个页面就爆了。 @jae-jae @windpursuer

from querylist.

jae-jae avatar jae-jae commented on July 26, 2024

你这才是正确用法,看看QueryList官方文档给出的例子:

from querylist.

mountainguan avatar mountainguan commented on July 26, 2024

@jae-jae 或许把这个报错列出来提示新手遇到怎么解决会比较好,因为刚开始用也是糊里糊涂

from querylist.

jae-jae avatar jae-jae commented on July 26, 2024

我做一个专题

from querylist.

windpursuer avatar windpursuer commented on July 26, 2024

@mountainguan 感谢,就是你说的那种情况,我从数据库里取出待爬url列表后就不停循环创建新对象来抓取详情页,然后就爆掉了。@jae-jae 辛苦大神

from querylist.

smz-web avatar smz-web commented on July 26, 2024

没有办法解决

from querylist.

smz-web avatar smz-web commented on July 26, 2024

手册上的根本没用

from querylist.

KouSum avatar KouSum commented on July 26, 2024

rules 不是rule

from querylist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.