Thanks to this article from Maarten Willebrands, the issue is that Sitecore, pre 9.3, is configured to try and index too many things at once. When 9.3 was released they lowered the number.
The setting is the
SplitRecordsThreshold and it is located in the file C:<Path to xConnect>\App_data\jobs\continuous\IndexWorker\App_data\Config\Sitecore\SearchIndexer\sc.Xdb.Collection.IndexerSettings.xml
Controls the limit for the number of records loaded into memory (per
core) by the indexer at any one time.
If the indexer is using too much memory, decrease this value.
To disable splitting, set this value to 0, a negative value, or remove
the element completely.
The default in 9.1, the setting is
25000. But in 9.3+ the setting is
1000. I changed the number it 1000 and the indexing proceeds at a controlled pace and no longer consumes all the memory of the server.