Support » Installing WordPress » MT Import Memory LeaK?

  • I’ve been testing WP 2.0 and MT importing and I’ve got a bug I haven’t seen mentioned yet. mt.php causes a seg fault every one or 21 imports.

    [client] PHP Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to allocate 4 bytes) in /mmedia/u/pub/jjarrett/wp-includes/functions-post.php on line 514, referer:

    Yes, I do run a default 8MB php and I could change it but the seg fauit doesn’t happen importing the same text file into a WP 1.5 installation. Its a half meg import file. The weird is that if I continue to re-import the same file it skips the previous postings (as it should) and imports the next 21 posts or msybe just one new post. Any clues as to who’s holding memory?

    PHP 4.3.10, Fedora Core 2 Linux. Apache/2.0.51

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’ve still got the strange memory leak/seg fault when importing in WP.2.0 . After I increased the the php allocation to 16MB from 8MB, it’s importing more posts but it still seq faults. Wp1.5 at 8MB has no problem with the same import file.

    The “1” or “21” posts is a red herring, that’s a race condition between what’s displayed in the browser before php seg faults and what’s is stored in the DB. The important clue would appear to be that there is plenty of memory (in either 8MB or 16MB) to pass through the big loop and process_posts() [mt.,php] since it happily skip posts made in the from previous imports. That strongly suggests the leak occurs in the “else” leg of the

    // Let's check to see if it's in already
    if ($post_id = post_exists($post_title, '', $post_date)) {

    There aren’t many calls from there that could leak, $this->checkauthor(), compact(…), wp_insert_post() and not likely wp_create_categories()..

    I don’t think it is the comment/trackback/ping code because my test file doesn’t have very many comments and I tried another import file that doesn’t have many posts (60) but a huge number of comments on one of them (242) and it sailed through. If I had to guess there’s a cache in wp_insert_post() thats holding on to posts that it shouldn’t, when importing.

    Ryan Boren


    WordPress Dev

    Right you are. I think post caching is getting in the way. We need to turn it off somehow when importing. We set a WP_IMPORTING flag when importing. We could check for that in get_post() and not cache if it’s set. I’ll look into it.


    Thanks for the confirmation.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘MT Import Memory LeaK?’ is closed to new replies.