Skip to content

Conversation

@realFlowControl
Copy link
Member

@realFlowControl realFlowControl commented Dec 27, 2025

Description

Since #3360 and with #3361 we disabled the code path for PHP 8.4's php_zend_mm_set_custom_handlers_ex(). This PR re-enables that code path again.

This uses the same approach as PHP <= 8.3 allocation profiling with the difference that for alloc(), realloc() and free() calls we do not "prepare" the ZendMM heap by manipulating the heap->use_custom_heap flag anymore. This was necessary for when the allocation fails, ZendMM might call zend_mm_gc() to try and free memory for a new chunk which would just return 0; in case a custom allocator is installed.

With us being able to hook into zend_mm_gc() we can stop manipulating the heap->use_custom_heap flag in the allocator hot path and only do so in case a zend_mm_gc() was triggered.

Additionally this adds a prof correctness tests with another custom allocator being used by setting USE_ZEND_ALLOC=0.

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@codecov-commenter
Copy link

codecov-commenter commented Dec 27, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 61.81%. Comparing base (7ce9fd6) to head (4cee785).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3550   +/-   ##
=======================================
  Coverage   61.81%   61.81%           
=======================================
  Files         140      140           
  Lines       13281    13281           
  Branches     1758     1758           
=======================================
  Hits         8209     8209           
  Misses       4282     4282           
  Partials      790      790           

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ce9fd6...4cee785. Read the comment docs.

🚀 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.

@pr-commenter
Copy link

pr-commenter bot commented Dec 27, 2025

Benchmarks [ profiler ]

Benchmark execution time: 2026-01-13 14:24:58

Comparing candidate commit 4cee785 in PR branch florian/alloc-php-84 with baseline commit 7ce9fd6 in branch master.

Found 1 performance improvements and 0 performance regressions! Performance is the same for 28 metrics, 7 unstable metrics.

scenario:php-profiler-timeline-memory-with-profiler

  • 🟩 cpu_user_time [-45.081ms; -27.034ms] or [-3.889%; -2.332%]

@realFlowControl realFlowControl force-pushed the florian/alloc-php-84 branch 2 times, most recently from 4e8b1eb to b061348 Compare January 13, 2026 12:54
@datadog-official
Copy link

datadog-official bot commented Jan 13, 2026

⚠️ Tests

Fix all issues with Cursor

⚠️ Warnings

🧪 1022 Tests failed

    testSearchPhpBinaries from integration.DDTrace\Tests\Integration\PHPInstallerTest (Fix with Cursor)

    testSimplePushAndProcess from laravel-58-test.DDTrace\Tests\Integrations\Laravel\V5_8\QueueTest (Fix with Cursor)

testSimplePushAndProcess from laravel-8x-test.DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest (Datadog) (Fix with Cursor)
DDTrace\Tests\Integrations\Laravel\V8_x\QueueTest::testSimplePushAndProcess
Test code or tested code printed unexpected output: spanLinksTraceId: 696664720000000039e85f4f6c02b605
tid: 6966647200000000
hexProcessTraceId: 39e85f4f6c02b605
hexProcessSpanId: 062a6117efc4fb87
processTraceId: 4172689849477936645
processSpanId: 444274268684221319

phpvfscomposer://tests/vendor/phpunit/phpunit/phpunit:106
View all

ℹ️ Info

❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 4cee785 | Docs | Datadog PR Page | Was this helpful? Give us feedback!

@realFlowControl realFlowControl force-pushed the florian/alloc-php-84 branch 2 times, most recently from c24208c to 1653fa2 Compare January 13, 2026 14:01
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.

3 participants