I'm writing a plugin which adds a whole bunch of pages to WP. My problem is memory use. Here's an extract of the code:
echo "D: ".(memory_get_usage() - $old_memory).""; $page_id = wp_insert_post($wm_mypost); echo "E: ".(memory_get_usage() - $old_memory)."";
D: 71652 E: 1898444
I could live with this memory use, but I'm in a loop so every time I call wp_insert_post my memory usage jumps by about 1Mb or so! (The loop calls a function, and wp_insert_post is inside the function. The memory is not reclaimed even when exiting the function.)
So, what can I do to reclaim this memory?