AWS Lambda runtime error after insert 220k rows to RDS Because Limit Memory

My task : Insert 29 million row to a table of Postgresql RDS.
I write code to insert each 1000 row / 1 time.
It run successfully
But after 220k row, it full memory
I increase memory of lambda to 2048, it still full memory

Normal invoke: It take 536 MB
Error invoke : It take fulll 2048 MB

I have image but it cannot up here for new member

Help me please T-T ?