Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add zfree_with_size #453

Open
wants to merge 6 commits into
base: unstable
Choose a base branch
from
Open

Add zfree_with_size #453

wants to merge 6 commits into from

Commits on Jun 3, 2024

  1. Add zfree_with_size

    zfree updates memory statistics. It gets the size of the buffer from
    jemalloc by calling zmalloc_size. This operation is costly. We can
    avoid it if we know the buffer size. For example, we can calculate
    size of sds from the data we have in its header.
    
    This commit introduces zfree_with_size function that accepts both
    pointer to a buffer, and its size. zfree is refactored to call
    zfree_with_size.
    
    sdsfree uses the new interface for all but SDS_TYPE_5.
    
    Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
    poiuj committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    0a2d984 View commit details
    Browse the repository at this point in the history
  2. Fix sdsAllocSize for SDS_TYPE_5

    sdsalloc returns sds's length for SDS_TYPE_5. It's not correct for
    SDS_TYPE_5.
    
    This patch makes sdsAllocSize call zmalloc_size for
    SDS_TYPE_5. sdsalloc is a lower level function that continues to
    return length for SDS_TYPE_5.
    
    Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
    poiuj committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    2310767 View commit details
    Browse the repository at this point in the history
  3. Do not include zmalloc into sds.c

    Instead of zmalloc_size use s_malloc_size.
    
    Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
    poiuj committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    37ad930 View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2024

  1. Apply suggestions from code review

    Change the doc string for `zfree_with_size`
    
    Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
    poiuj committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    21acd10 View commit details
    Browse the repository at this point in the history
  2. Update zfree_with_size() docstring

    Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
    poiuj committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    0c2048d View commit details
    Browse the repository at this point in the history
  3. Revert Makefile changes pushed by mistake

    Signed-off-by: Vadym Khoptynets <vadymkh@amazon.com>
    poiuj committed Jun 11, 2024
    Configuration menu
    Copy the full SHA
    72e6b28 View commit details
    Browse the repository at this point in the history