8000 MEMORY USAGE over-counts short keys of hashes with field TTLs (inline keys since #490) · Issue #497 · kividbio/kividb · GitHub
[go: up one dir, main page]

Skip to content

MEMORY USAGE over-counts short keys of hashes with field TTLs (inline keys since #490) #497

Open

Description

@murtazayusuf

field_expiry::watch_entry_size(key_len) returns size_of::<(Entry, Instant)>() + 1 + key_len. That assumes the key is a heap-allocated String. Since #490, Entry's key is a KeyBytes, which keeps keys of up to 23 bytes inline, so for those keys MEMORY USAGE of a hash with field TTLs counts about key_len bytes that were never allocated.

The current tolerances in tests/memory_usage_accuracy.rs still pass. Fix: count key_len only when KeyBytes would put the key on the heap.

Found while reviewing #496.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0