Skip to content

Add max_memory_usage field to tidesdb_config_t#40

Closed
mukesh-2096 wants to merge 1 commit intotidesdb:masterfrom
mukesh-2096:add-max-memory-usage
Closed

Add max_memory_usage field to tidesdb_config_t#40
mukesh-2096 wants to merge 1 commit intotidesdb:masterfrom
mukesh-2096:add-max-memory-usage

Conversation

@mukesh-2096
Copy link
Copy Markdown
Contributor

Description

This PR adds the max_memory_usage configuration field to tidesdb_config_t, allowing users to set memory usage limits when opening a TidesDB database instance.

Changes Made

  • Added size_t max_memory_usage field to the tidesdb_config_t FFI structure
  • Updated tidesdb.default_config() to include max_memory_usage with a default value of 0 (unlimited)
  • Modified TidesDB.new() constructor to handle the max_memory_usage configuration parameter
  • Updated TidesDB.open() method to accept max_memory_usage as an option
  • Default value of 0 indicates unlimited memory usage

Usage Example

local tidesdb = require("tidesdb")

-- Option 1: Using TidesDB.open() with max_memory_usage
local db = tidesdb.TidesDB.open("./mydb", {
    max_memory_usage = 512 * 1024 * 1024  -- 512 MB limit
})

-- Option 2: Using default config
local config = tidesdb.default_config()
config.max_memory_usage = 1024 * 1024 * 1024  -- 1 GB limit
local db = tidesdb.TidesDB.new(config)

@guycipher
Copy link
Copy Markdown
Member

That's correct. Good stuff, thank you

@guycipher
Copy link
Copy Markdown
Member

@mukesh-2096 one favor, can you put your new tests in test_tidesdb.lua, to be consistent. I do not like the new file, its random. Please follow the comment and code style.

@mukesh-2096
Copy link
Copy Markdown
Contributor Author

@guycipher
okay, sure
i will update it

@guycipher
Copy link
Copy Markdown
Member

Thank you

@guycipher guycipher closed this Feb 23, 2026
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.

2 participants