In my opinion, the conversion failure of docx to pdf may not be directly related to the memory spike.
To troubleshoot the error code 6 in the Word Automation Service Database, you could refer following two articles.
SharePoint Word Automation Service Not Working
Word Automation Services Error Code 6
To reduce the resource usage for SharePoint Search component, you could check the crawl schedule and limit NodeRunner.exe.
If an Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.