Skip to content

Commit

Permalink
Memory Leak Fix: Implementing jemalloc Allocator (#205)
Browse files Browse the repository at this point in the history
* update: added jemallocator
  • Loading branch information
heemankv authored Jan 24, 2025
1 parent 9000464 commit afb9afe
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#### SYSTEM ####
JEMALLOC_SYS_WITH_MALLOC_CONF=

#### AWS CONFIG ####
AWS_ACCESS_KEY_ID= # Your AWS access key ID
AWS_SECRET_ACCESS_KEY= # Your AWS secret access key
Expand Down
2 changes: 2 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#### SYSTEM ####
JEMALLOC_SYS_WITH_MALLOC_CONF="background_thread:true,narenas:1,tcache:false,dirty_decay_ms:0,muzzy_decay_ms:0,abort_conf:true"

#### AWS CONFIG ####

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).

## Fixed

- add jemallocator to fix memory leak
- refactor: instrumentation
- `is_worker_enabled` status check moved from `VerificationFailed` to `Failed`
- refactor: static attributes for telemetry
Expand Down
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ cairo-vm = { git = "https://github.com/Moonsong-Labs/cairo-vm", branch = "notles
"mod_builtin",
] }

jemallocator = "0.5.4"

# Snos & Sharp (Starkware)
# TODO: need to update this once the updated PR merges
Expand Down
2 changes: 2 additions & 0 deletions crates/orchestrator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ tracing-core = { workspace = true, default-features = false }
tracing-opentelemetry = { workspace = true }
tracing-subscriber = { workspace = true, features = ["env-filter"] }

jemallocator = { workspace = true }

[features]
default = ["ethereum", "with_mongodb", "with_sqs"]
ethereum = ["ethereum-da-client"]
Expand Down
3 changes: 3 additions & 0 deletions crates/orchestrator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ use orchestrator::routes::setup_server;
use orchestrator::setup::setup_cloud;
use orchestrator::telemetry::{setup_analytics, shutdown_analytics};

#[global_allocator]
static A: jemallocator::Jemalloc = jemallocator::Jemalloc;

/// Start the server
#[tokio::main]
// not sure why clippy gives this error on the latest rust
Expand Down

0 comments on commit afb9afe

Please sign in to comment.