Skip to content

Commit f249ad3

Browse files
Fix initialization crash for WTinyLFU when parameters are empty (#296)
* fix(cachesim): prevent malformed tinyLFU params when input is empty * style: remove trailing whitespace and use NULL for default params
1 parent 722f765 commit f249ad3

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

libCacheSim/bin/cachesim/cache_init.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,8 @@ static inline cache_t *create_cache(const char *trace_path,
103103
cc_params.hashpower = MAX(cc_params.hashpower - 8, 16);
104104
cache = Hyperbolic_init(cc_params, eviction_params);
105105
} else if (strcasecmp(eviction_algo, "tinyLFU") == 0) {
106-
if (eviction_params == NULL) {
107-
cache = WTinyLFU_init(cc_params, eviction_params);
106+
if (eviction_params == NULL || eviction_params[0] == '\0') {
107+
cache = WTinyLFU_init(cc_params, NULL);
108108
} else {
109109
const char *window_size = strstr(eviction_params, "window-size=");
110110
if (window_size == NULL) {

0 commit comments

Comments
 (0)