+ memcached_server_st *list;
+ uint32_t pointer_counter= 0;
+ uint32_t pointer_per_server= MEMCACHED_POINTS_PER_SERVER;
+ memcached_return rc;
+ uint64_t total_mem_bytes= 0;
+ memcached_stat_st *stat_p= NULL;
+ uint32_t is_ketama_weighted= 0;
+
+ if (ptr->number_of_hosts > ptr->continuum_count)
+ {
+ memcached_continuum_item_st *new_ptr;
+
+ if (ptr->call_realloc)
+ new_ptr= (memcached_continuum_item_st *)ptr->call_realloc(ptr, ptr->continuum, sizeof(memcached_continuum_item_st) * (ptr->number_of_hosts + MEMCACHED_CONTINUUM_ADDITION) * MEMCACHED_POINTS_PER_SERVER);
+ else
+ new_ptr= (memcached_continuum_item_st *)realloc(ptr->continuum, sizeof(memcached_continuum_item_st) * (ptr->number_of_hosts + MEMCACHED_CONTINUUM_ADDITION) * MEMCACHED_POINTS_PER_SERVER);
+
+ if (new_ptr == 0)
+ return MEMCACHED_MEMORY_ALLOCATION_FAILURE;
+
+ ptr->continuum= new_ptr;
+ ptr->continuum_count= ptr->number_of_hosts + MEMCACHED_CONTINUUM_ADDITION;
+ }
+
+ list = ptr->hosts;
+
+ is_ketama_weighted= memcached_behavior_get(ptr, MEMCACHED_BEHAVIOR_KETAMA_WEIGHTED);
+ if(is_ketama_weighted)
+ {
+ stat_p = memcached_stat(ptr, NULL, &rc);
+ for (host_index = 0; host_index < ptr->number_of_hosts; ++host_index)
+ {
+ list[host_index].limit_maxbytes= (stat_p + host_index)->limit_maxbytes;
+ total_mem_bytes += (stat_p + host_index)->limit_maxbytes;
+ }
+ }