Skip to content

Fix leaks, optimize memory usage#157

Merged
ThomasWaldmann merged 3 commits intoborgbackup:masterfrom
ThomasWaldmann:fix-leaks
Apr 24, 2026
Merged

Fix leaks, optimize memory usage#157
ThomasWaldmann merged 3 commits intoborgbackup:masterfrom
ThomasWaldmann:fix-leaks

Conversation

@ThomasWaldmann
Copy link
Copy Markdown
Member

No description provided.

- Store paramiko.SSHClient in self.ssh and ensure it is closed in _disconnect.
- _connect calls _disconnect on any failure during setup.
Ensure the rclone process is properly terminated and waited on in close(),
preventing zombie processes and resource leaks.
Use a generator expression to convert backend items to dictionaries
directly for json.dumps(). This avoids building an intermediate list
of ItemInfo objects, reducing memory pressure for large directories.

This is only a slight optimization, avoiding to stream one dict after
another manually, which would save more memory, but require uglier
code. We operate at backend api layer, we only list single dirs.
@ThomasWaldmann ThomasWaldmann merged commit 7afaa6d into borgbackup:master Apr 24, 2026
9 checks passed
@ThomasWaldmann ThomasWaldmann deleted the fix-leaks branch April 24, 2026 23:20
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.

1 participant