PHP-1295: Memory leak when generating ID for inserts