Skip to content

Assertion failure in Zend/zend_gc.c #15943

Closed
Closed

Description

@YuanchengJiang

Description

The following code:

<?php
$wm = new WeakMap();
for ($i = 0; $i < 30_000; $i++) {
$fusion[] = $obj = new stdClass;
$wm[$obj] = $obj;
}
$tmp = $wm;
$tmp = null;
gc_collect_cycles();

Resulted in this output:

/php-src/Zend/zend_gc.c:791: gc_remove_from_buffer: Assertion `idx' failed.
Aborted (core dumped)

To reproduce:

-d "memory_limit=8M"

PHP Version

PHP 8.4.0-dev

Operating System

ubuntu 22.04

Activity

  1. cmb69 commented on Sep 18, 2024

    @cmb69
    Member

    For me, this script outputs:

    Fatal error: Allowed memory size of 8388608 bytes exhausted at Zend\zend_gc.c:2141 (tried to allocate 1048608 bytes) in %s on line %d
    Assertion failed: idx, file Zend\zend_gc.c, line 791
    
  2. cmb69 commented on Sep 21, 2024

    @cmb69
    Member

    PHP-8.3 (and maybe lower branches) exhibit the same behavior.

  3. self-assigned this
    on Sep 21, 2024
  4. added theissue type on Feb 5, 2025
  5. ndossche commented on Oct 25, 2026

    @ndossche
    Member

    This is fixed as a consequence of the general graceful OOM handling, closing.

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

Metadata

Metadata

Assignees

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions