Skip to content

Skip auto-lowmem logic for large files#667

Merged
cperciva merged 1 commit intomasterfrom
trailer-10MB+
Dec 20, 2025
Merged

Skip auto-lowmem logic for large files#667
cperciva merged 1 commit intomasterfrom
trailer-10MB+

Conversation

@cperciva
Copy link
Member

In Tarsnap 1.0.15 (November 2008) code was added to switch into a quasi-lowmem mode if it finds that a lot of memory is being used to cache small files.

Adjust that behaviour to only kick in for files which are < 10 MB in size; larger files will be fully cached (unless --lowmem or --verylowmem are specified explicitly) so they don't need to be re-read on every run.

Reported by: Tim Bishop

In Tarsnap 1.0.15 (November 2008) code was added to switch into a
quasi-lowmem mode if it finds that a lot of memory is being used to
cache small files.

Adjust that behaviour to only kick in for files which are < 10 MB
in size; larger files will be fully cached (unless --lowmem or
--verylowmem are specified explicitly) so they don't need to be
re-read on every run.

Reported by:	Tim Bishop

/*
* Decide if we want to keep a trailer: We follow the policy provided
* by the caller (record a trailer unless notrailer != 0) unless we're
Copy link
Member

Choose a reason for hiding this comment

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

I was a bit confused by the "unless notrailer != 0" bit in the comment, since that's not part of this "paragraph". If we already have notrailer = 1, then that only applies below on line 567.

For clarity, I'd be tempted to put lines 561-563 inside an

if (notrailer == 0) {
}

OTOH, you might take the view that anybody reading this section should be able to figure it out, so shrug.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I agree it's not the clearest code but I don't want to complicate things by adding another conditional either. I think this is fine.

@cperciva cperciva merged commit 69d1571 into master Dec 20, 2025
2 checks passed
@cperciva
Copy link
Member Author

BTW this doesn't actually fix Tim's issue; what he was running into was the MAXAGE setting in ccache_internal.h. We need to make that a configuration setting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants