"Derrick Stolee via GitGitGadget" [off-list ref] writes:
+static int safe_memory_limit_check(size_t size, int verbose)
{
+ size_t limit = git_alloc_limit ? git_alloc_limit : SIZE_MAX;
+ if (size > limit) {
+ if (verbose)
error("attempting to allocate %"PRIuMAX" over limit %"PRIuMAX,
(uintmax_t)size, (uintmax_t)git_alloc_limit);
+ return -1;
}
return 0;
}
The code is prepared for a case where git_alloc_limit is set to 0,
in which case SIZE_MAX is used as a stand-in value. When the check
detects a request with overly large 'size', the error message tells
us that 'size' is over 'git_alloc_limit', the latter is zero and any
concrete value of 'size' certainly would be over that. Which may be a
bit confusing.
Shouldn't we be giving the local "limit" instead in the message?