Memory problems when compiling

I have been compiling a circa-150 page science textbook, which also includes many images that have been inserted into the text, and have encountered two problems that seem to be related.

  1. When trying to compile the document into certain format types (especially DOCX, but sometimes also PDF), I get either an “out of memory” notice, or the program itself will just crash. The computer I work on is pretty beefy (32 GB of RAM, actually, and plenty of hard drive space).

  2. Or, if it does successfully compile, it will be missing images, especially toward the end of the textbook. They still exist in the Scrivener project, but they do not appear in the compiled document. I can add them back in Word, but needless to say this is a pretty darn annoying procedure.