1、内存申请函数调用
创新互联建站是一家专注于成都网站建设、做网站与策划设计,巧家网站建设哪家好?创新互联建站做网站,专注于网站建设十余年,网设计领域的专业建站公司;建站业务涵盖:巧家等地区。巧家做网站价格咨询:18982081108
write_master->write_master_dim->write_master_bin_ops
->write_master_bin_ops_loop->as_bin_particle_alloc_from_client:
该函数对as_bin_s->particle进行申请内存,并将相关bin属性和值load到
申请的内存中。
2、内存释放函数调用
as_record_done->as_record_destroy->as_record_clean_bins
->as_record_clean_bins_from
-
void as_record_clean_bins_from(as_storage_rd *rd, uint16_t from)
-
{
-
for (uint16_t i = from; i < rd->n_bins; i++) {
-
//对每个bin进行释放
-
as_bin *b = &rd->bins[i];
-
if (as_bin_inuse(b)) {//bin state有效
-
as_bin_particle_destroy(b, rd->ns->storage_data_in_memory);
-
as_bin_set_empty(b);//设置bin的状态AS_BIN_STATE_UNUSED
-
}
-
}
-
}
-
void as_bin_particle_destroy(as_bin *b, bool free_particle)
-
{
-
if (as_bin_is_embedded_particle(b)) {
-
b->particle = 0;//int、float类型没有申请空间,这里set 0即可
-
}
-
else if (b->particle) {
-
if (free_particle) {
-
particle_vtable[as_bin_get_particle_type(b)]->destructor_fn(b->particle);
-
}
-
//根据类型调用destructor函数,blob的调用blob_destruct,其实是cf_free(p)
-
//释放了空间,将其set 0
-
b->particle = 0;
-
}
-
}
当前题目:Aerospike的bin内存管理--即列内存管理
文章位置:
http://bzwzjz.com/article/jsjjhh.html