Menu

#22 problem with GEOIP_INDEX_CACHE

open
nobody
None
5
2011-11-30
2011-11-30
No

If you open a Country database (or any database with only index data) and GEOIP_INDEX_CACHE in flags, it will try to allocate wrong size of memory. (for example, COUNTRY_BEGIN * record_length * 2).

Also, if you specify both GEOIP_INDEX_CACHE and GEOIP_MEMORY_CACHE it will allocate memory for index_cache, which is not necessary.

I suggest you use a table like this to handle memory allocation:

compute a boolean variable is_index_file, set to true if databaseSegments is one of COUNTRY_BEGIN, LARGE_COUNTRY_BEGIN
STATE_BEGIN_REV0 or STATE_BEGIN_REV1.

is_index_file - GEOIP_INDEX_CACHE - GEOIP_MEMORY_CACHE
0-0-0: action 0: do nothing
0-0-1: action 1: allocate memory_cache, set index_cache = cache
0-1-0: action 2: allocate index_cache
0-1-1: action 1
1-0-0: action 0
1-0-1: action 1
1-1-0: action 1
1-1-1: action 1

Best regards,
Alejandro Lapeyre

Discussion


Log in to post a comment.