# Memory exhausted error on resortSiblingsAfterListing

**URL:** <https://forum.getkirby.com/t/memory-exhausted-error-on-resortsiblingsafterlisting/34829>\
**Category:** Questions\
**Tags:** v5\
**Created:** [October 6, 2025, 12:31pm UTC](https://forum.getkirby.com/t/memory-exhausted-error-on-resortsiblingsafterlisting/34829 "2025-10-06T12:31:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![meirsadan](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/meirsadan/32/15162_2.png) [@meirsadan](https://forum.getkirby.com/u/meirsadan)\
**Post date:** [October 6, 2025, 12:31pm UTC](https://forum.getkirby.com/t/memory-exhausted-error-on-resortsiblingsafterlisting/34829/1 "2025-10-06T12:31:44Z")

</div>

Hi there,

I’ve created a script that imports data from a CSV page (an export of Woocommerce orders) and creates new pages (merx orders) programatically from them.

The script worked well for a while but there are now 2,673 orders and every time I am importing a new page I am getting this memory error: `"Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)"`

I traced the error to the function `resortSiblingsAfterListing` in `/kirby/src/Cms/PageActions.php` specifically to this line (772-775):

```php
$listed = $siblings
            ->listed()
            ->append($this)
            ->filter(fn ($page) => $page->blueprint()->num() === 'default');

```

This is run after I create the new page as draft and change the status to “listed”.

Just for reference, this is how I call the page creation function:

```php
$imported_order = Kirby\Cms\Page::create( [
  "template" => "order",
  "model" => "order",
  "draft" => true,
  "parent" => page( "orders" ),
  "slug" => Kirby\Toolkit\Str::slug( $order_data["wc_order_key"] ),
  "content" => $order_data,
] )->changeStatus( "listed" );

```

I am running this code on a Kirby v5 installation on a local MAMP server running PHP . Does this mean there are too many pages in the directory to complete the code?

I am also enclosing my (local) system info in case this helps (upgraded to Kirby v5.1.2 after seeing I wasn’t up to date but the error persists):

```json
{
  "info": {
    "kirby": "5.0.1",
    "php": "8.3.14",
    "server": "Apache/2.4.62 (Unix) mod_wsgi/5.0.1 Python/3.12 mod_fastcgi/mod_fastcgi-SNAP-0910052141 OpenSSL/1.1.1w",
    "license": "Unregistered",
    "languages": [
      "en",
      "he"
    ]
  },
  "security": [
    "The site is running locally with relaxed security checks",
    "Debugging must be turned off in production",
    "The Vue template compiler is enabled"
  ],
  "plugins": [
    {
      "name": "bnomei/janitor",
      "version": "5.3.0"
    },
    {
      "name": "bvdputte/kirbylog",
      "version": "2.2.0"
    },
    {
      "name": "fontef/font-field",
      "version": "?"
    },
    {
      "name": "fontef/order-interface",
      "version": "?"
    },
    {
      "name": "fontef/royalties",
      "version": "?"
    },
    {
      "name": "fontef/typetool",
      "version": "?"
    },
    {
      "name": "rasteiner/whenquery",
      "version": "0.5.0"
    },
    {
      "name": "sylvainjule/multilist",
      "version": "1.1.0"
    },
    {
      "name": "typolog/csv-viewer",
      "version": "?"
    },
    {
      "name": "typolog/generator",
      "version": "?"
    },
    {
      "name": "typolog/helpers",
      "version": "?"
    },
    {
      "name": "typolog/price-table",
      "version": "?"
    },
    {
      "name": "typolog/specimen-block",
      "version": "1.0.1"
    },
    {
      "name": "ww/merx",
      "version": "1.10.0"
    }
  ]
}

```

Thanks!
