Skip to content

Fix compilation error: replace deprecated je_calloc with zcalloc_num#3592

Merged
lucasyonge merged 1 commit into
valkey-io:unstablefrom
jaduffy:fix/issue-1905-deprecated-calloc
Apr 30, 2026
Merged

Fix compilation error: replace deprecated je_calloc with zcalloc_num#3592
lucasyonge merged 1 commit into
valkey-io:unstablefrom
jaduffy:fix/issue-1905-deprecated-calloc

Conversation

@jaduffy

@jaduffy jaduffy commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Fixes #1905

Summary

The direct use of je_calloc in src/allocator_defrag.c causes compilation failures on systems (e.g., Arch Linux with GCC 14.2.1) where calloc is marked as deprecated and -Werror=deprecated is enabled.

Changes

Replace the two je_calloc calls in allocatorDefragInit() with zcalloc_num, which is the proper Valkey allocation wrapper that provides the same semantics (num × size with zero-fill) without directly invoking the deprecated calloc symbol.

Testing

  • Build compiles cleanly
  • Integration tests pass (unit/memefficiency, defrag, unit/other — 51 passed, 0 failed)

@codecov

codecov Bot commented Apr 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.63%. Comparing base (678a06d) to head (e5410e3).
⚠️ Report is 5 commits behind head on unstable.

Additional details and impacted files
@@            Coverage Diff            @@
##           unstable    #3592   +/-   ##
=========================================
  Coverage     76.63%   76.63%           
=========================================
  Files           160      160           
  Lines         80472    80472           
=========================================
  Hits          61668    61668           
  Misses        18804    18804           
Files with missing lines Coverage Δ
src/allocator_defrag.c 100.00% <100.00%> (ø)

... and 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@roshkhatri roshkhatri left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

the only behavioral delta i could see is that these two init-time allocations would now get tracked in zmalloc's used_memory stats, which is should be okay than how it was bypassing before.

Fixes valkey-io#1905. The direct use of je_calloc in allocator_defrag.c causes
compilation failures on systems (e.g., Arch Linux with GCC 14.2.1) where
calloc is marked as deprecated with -Werror=deprecated. Replace the two
je_calloc calls with zcalloc_num which is the proper Valkey allocation
wrapper that handles the calloc semantics (num * size with zero-fill).

Signed-off-by: jaduffy <jaduffy@amazon.com>
@jaduffy jaduffy force-pushed the fix/issue-1905-deprecated-calloc branch from 63a7198 to e5410e3 Compare April 29, 2026 23:40

@lucasyonge lucasyonge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, Thanks

@lucasyonge lucasyonge merged commit 72fc5b1 into valkey-io:unstable Apr 30, 2026
59 checks passed
lucasyonge pushed a commit that referenced this pull request May 11, 2026
…3592)

Fixes #1905

## Summary
The direct use of `je_calloc` in `src/allocator_defrag.c` causes
compilation failures on systems (e.g., Arch Linux with GCC 14.2.1) where
`calloc` is marked as deprecated and `-Werror=deprecated` is enabled.

## Changes
Replace the two `je_calloc` calls in `allocatorDefragInit()` with
`zcalloc_num`, which is the proper Valkey allocation wrapper that
provides the same semantics (num × size with zero-fill) without directly
invoking the deprecated `calloc` symbol.

## Testing
- Build compiles cleanly
- Integration tests pass (unit/memefficiency, defrag, unit/other — 51
passed, 0 failed)

Signed-off-by: jaduffy <jaduffy@amazon.com>
lucasyonge pushed a commit that referenced this pull request May 12, 2026
…3592)

Fixes #1905

## Summary
The direct use of `je_calloc` in `src/allocator_defrag.c` causes
compilation failures on systems (e.g., Arch Linux with GCC 14.2.1) where
`calloc` is marked as deprecated and `-Werror=deprecated` is enabled.

## Changes
Replace the two `je_calloc` calls in `allocatorDefragInit()` with
`zcalloc_num`, which is the proper Valkey allocation wrapper that
provides the same semantics (num × size with zero-fill) without directly
invoking the deprecated `calloc` symbol.

## Testing
- Build compiles cleanly
- Integration tests pass (unit/memefficiency, defrag, unit/other — 51
passed, 0 failed)

Signed-off-by: jaduffy <jaduffy@amazon.com>
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.

[BUG] 8.1.0 fails to compile due to deprecated calloc

5 participants