-
Notifications
You must be signed in to change notification settings - Fork 468
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The problem with the Chinese phone numbers. #44
Comments
Yikes, that array contains ~145,800 items. I'll have a look at a way of solving this. |
Reduces PHP memory usage when large PHP arrays are loaded
* GeoLocationMemoryReduction: Split Chinese PrefixMapper files into more files (#44)
I've split up the Chinese prefix mapper (geolocation & carrier mapper) files into smaller files, which has greatly reduced the memory usage when testing your number on my local PC. Once Google release a new version, it'll get tagged, but for the time being, you can test it by using Demo Code<?php
$number = PhoneNumberUtil::getInstance()->parse("86-157-9662-1289", "CN");
$geocoder = PhoneNumberOfflineGeocoder::getInstance();
$startMemory = memory_get_usage();
$location = $geocoder->getDescriptionForNumber($number, "en");
$endMemory = memory_get_usage();
$memoryUsed = $endMemory - $startMemory; BeforeMemory usage: find . -name "*.php" -type f -not -path "./vendor/*" | xargs wc -l|sort -rn|grep -v ' total$' | head -n 10
AfterMemory Usage: find . -name "*.php" -type f -not -path "./vendor/*" | xargs wc -l|sort -rn|grep -v ' total$' | head -n 10
|
The problem with memory usage was solved. But another one appeared. When I use geocoding I receive only one result: China. That is all. There is no detalization as it was befor: no province, no city. |
Is it the same number as per the original report? If so, I tried that on I just tried that number in Google's demo page, and that said "China" too. The problem with memory usage was solved. But another one appeared. When I — |
Yes, the original number does not description, so the answer China is correct. But I try many others, for |
Okay, I can see that's an issue. I'll work on it today. |
Okay, I believe I've fixed that now. |
The tests are failing because it's now reporting a higher memory usage. This is because it's finding the files to load (and not finding an entry for your original number, but is for the second set of numbers). Can you check to see if it's still causing you memory issues with the latest |
Yes, the problem with memory return. |
I have the problem with existing number also. |
I am testing with many combiantion of area codes and phone numbers. The problem only with area-code 130 - 139. These codes stored in 8613.php. By the way this is the bigest file(1.7Mb) and contains many items. |
We might have to store them with 5 digits instead of 4 then. Just a note that the default memory_limit for PHP is 128M, and yours is set to 32M. ( http://php.net/manual/en/ini.core.php#ini.memory-limit ). |
Please, could you answer what do we do now? Is your recommendation of increasing memory_limit final? The resolving of this problem is very important for us. |
I'm looking at splitting up the files into the first 5 digits. |
Also fix a bug with PhoneNumberToCarrierMapper with getInstance()
Can you give it another try? Both the original number, and 86-131-2270-1411 now geo-locate using less than 5MB of memory. |
It is working perfectly now. Thanks a lot. That is a good luck for us. |
Excellent. Like I said in a previous comment, it'll be in a tagged release once Google release a new version upstream. |
Hello everybody. I get some problems with en/86.php. This file is too big compare with others (4,8Mb).
So, I must spend big amount of valuable memory (almost 75Mb) when use geocoding for Chinese phone numbers. When I add necessary size of memory by ini_set (although it is not good) I anyway get problems with geocoding some numbers. For example I try use geocoding for 86-157-9662-1289.
Actualy there is no such number and I should get empty result, instead I get fatal error, because it is need even more memory. Why that, I don't no. Anybody knows how to resolve this problem with memory wasting? May be should split the file 86.php into smaller files. Please, help me.
The text was updated successfully, but these errors were encountered: