MCPcopy Create free account
hub / github.com/apache/impala / Allocate

Method Allocate

be/src/util/cache/rl-cache.cc:268–288  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266
267template<Cache::EvictionPolicy policy>
268HandleBase* RLCacheShard<policy>::Allocate(Slice key, uint32_t hash, int val_len,
269 size_t charge) {
270 DCHECK(initialized_);
271 int key_len = key.size();
272 DCHECK_GE(key_len, 0);
273 DCHECK_GE(val_len, 0);
274 DCHECK_GT(charge, 0);
275 if (charge == 0) return nullptr;
276 int key_len_padded = KUDU_ALIGN_UP(key_len, sizeof(void*));
277 uint8_t* buf = new uint8_t[sizeof(RLHandle)
278 + key_len_padded + val_len]; // the kv_data VLA data
279 // TODO(KUDU-1091): account for the footprint of structures used by Cache's
280 // internal housekeeping (RL handles, etc.) in case of
281 // non-automatic charge.
282 int calc_charge =
283 (charge == Cache::kAutomaticCharge) ? kudu::kudu_malloc_usable_size(buf) : charge;
284 uint8_t* kv_ptr = buf + sizeof(RLHandle);
285 RLHandle* handle = new (buf) RLHandle(kv_ptr, key, hash, val_len,
286 calc_charge);
287 return handle;
288}
289
290template<Cache::EvictionPolicy policy>
291void RLCacheShard<policy>::Free(HandleBase* handle) {

Callers 13

MaterializeValuesMethod · 0.45
CreateTupleRowMethod · 0.45
ProcessBlockMethod · 0.45
CompressAndDecompressMethod · 0.45
TEST_FFunction · 0.45
AddToTableMethod · 0.45
DoQueriesMethod · 0.45

Calls 2

kudu_malloc_usable_sizeFunction · 0.85
sizeMethod · 0.45

Tested by 9

CreateTupleRowMethod · 0.36
CompressAndDecompressMethod · 0.36
TEST_FFunction · 0.36
InsertMethod · 0.36