O
O
olezhenka2017-09-09 12:44:04
PHP
olezhenka, 2017-09-09 12:44:04

Not enough RAM due to many variables in php array?

I need to parse several million id users in VK, and then compare them with my list where there are also a lot of users and find the intersection. I did this and got an error that there is not enough memory. The maximum in the settings the script can consume 126 MB, I need to keep within the lower consumption, is it possible? You can give an example of how such services work - stats.ecotime.me/comparisons, at least in words. After all, there are many users who want to make an intersection, and the memory is not infinite.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2017-09-09
@Stalker_RED

Instead of a regular array, you can use SplFixedArray or even Judy array .
But isn't it better to do it in a database?

E
Egor, 2017-09-09
@egormmm

Upload data in batches. For example, 1000 pcs. for 1 request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question