Attempt to free up to 20% of the plasma store capacity during eviction. (#159)

This commit is contained in:
Robert Nishihara
2016-12-27 12:12:33 -08:00
committed by Philipp Moritz
parent 985c424172
commit 26941e02aa
+4 -2
View File
@@ -168,11 +168,13 @@ void require_space(eviction_state *eviction_state,
int64_t required_space =
eviction_state->memory_used + size - eviction_state->memory_capacity;
if (required_space > 0) {
/* Try to free up as much free space as we need right now. */
/* Try to free up at least as much space as we need right now but ideally
* up to 20% of the total capacity. */
int64_t space_to_free = MAX(size, eviction_state->memory_capacity / 5);
LOG_DEBUG("not enough space to create this object, so evicting objects");
/* Choose some objects to evict, and update the return pointers. */
int64_t num_bytes_evicted = choose_objects_to_evict(
eviction_state, plasma_store_info, required_space, num_objects_to_evict,
eviction_state, plasma_store_info, space_to_free, num_objects_to_evict,
objects_to_evict);
printf("Evicted %" PRId64 " bytes.\n", num_bytes_evicted);
LOG_INFO(