K
K
khodos_dmitry2017-05-25 09:54:07
PHP
khodos_dmitry, 2017-05-25 09:54:07

Why does the parser script eat up all the RAM?

After an hour or two, even if put in one thread, it turns out like this:
75aa6dcdfe8c4028bd94079c0fc38011.png
I read that it seems that phpQuery devours memory like this. I think XPath to put.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pushkarev, 2017-05-25
@khodos_dmitry

phpQuery doesn't clean up memory after itself. You need to do this through phpQuery::unloadDocuments();. Here is an example:

$pq = phpQuery::newDocument($html);

$projects =[];

foreach ($pq['.project-preview'] as $work) {
    $pqwork = pq($work);

    $projects[]['name'] = $pqwork['div']->eq(1)->text();
}

phpQuery::unloadDocuments();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question