load_files_multithreaded() calls file_load_data() which reads the entire file into a mallocd buffer (up to STREAM_THRESHOLD = 64MB). With queue depth 100 chunks of ~10MB each, memory usage can reach ~1GB.
Use mmap() instead of malloc() + read() for files below STREAM_THRESHOLD — this allows the OS to page data in/out
Reduce default queue depth for memory-constrained environments
Use a memory budget rather than fixed queue slot count
Severity
high
Category
performance
Sub-Agent
perf-analyst (PA-2)
This issue was automatically generated by the issue-creator agent.
## Description
`load_files_multithreaded()` calls `file_load_data()` which reads the entire file into a mallocd buffer (up to STREAM_THRESHOLD = 64MB). With queue depth 100 chunks of ~10MB each, memory usage can reach ~1GB.
## Location
src/client/client_send.c:331-357 (load_files_multithreaded)
src/shared/file.c:92-119 (file_load_data)
## Suggested Fix
1. Use `mmap()` instead of `malloc()` + `read()` for files below STREAM_THRESHOLD — this allows the OS to page data in/out
2. Reduce default queue depth for memory-constrained environments
3. Use a memory budget rather than fixed queue slot count
## Severity
high
## Category
performance
## Sub-Agent
perf-analyst (PA-2)
---
_This issue was automatically generated by the issue-creator agent._
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Description
load_files_multithreaded()callsfile_load_data()which reads the entire file into a mallocd buffer (up to STREAM_THRESHOLD = 64MB). With queue depth 100 chunks of ~10MB each, memory usage can reach ~1GB.Location
src/client/client_send.c:331-357 (load_files_multithreaded)
src/shared/file.c:92-119 (file_load_data)
Suggested Fix
mmap()instead ofmalloc()+read()for files below STREAM_THRESHOLD — this allows the OS to page data in/outSeverity
high
Category
performance
Sub-Agent
perf-analyst (PA-2)
This issue was automatically generated by the issue-creator agent.
Fixed in PR #148 — merged into main on 2026-07-29.