Skip to content

Conversation

vyavdoshenko
Copy link

This fix is to be used for dragonflydb/dragonfly#5480

Copy link

@romange romange left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dranikpg can you please reviews?

My thought is that it's possible to do it externally without making changes to the library itself.

@romange romange requested a review from dranikpg October 7, 2025 06:18
@dranikpg
Copy link

dranikpg commented Oct 8, 2025

As far as I could find, the is no way to compute the requested memory usage, neither the real memory usage (i.e. mi_good_size) as the library doesn't have control over this. What it does support is polymorphic allocators and we're already using them to get the total memory usage of all json objects.

A simpler solution in terms of code, but with higher overhead, would be "copying" the json object with a custom memory resource and counting the memory usage from within. Should be just a few lines of code inside Dragonfly... Though we'll end up copying the object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants