The narrative repeatedly emphasizes that the "inhabitants" of Living Memory are computer simulations based on memories. This is not a story that explores philosophical questions like "if AI acts like a human, does it actually have personhood?", because concepts that are intangible and theoretical to us (souls, memories, etc) are scientifically understood quantities in this fictional world. If you accept the premise of the world-building being presented to us, then Living Memory's only life is its plants and animals.
Personhood aside, Living Memory has to be shut down; it can only sustain its existence by infinitely harvesting the lives of others. It's the classic sci-fi catastrophe
grey goo.
The only viable solution is so obvious that it would be disingenuous to truly refer to this as any kind of trolley problem; you have a society made entirely of computer simulations on one track, and
every life throughout the universe on the other. Which track should you switch the trolley onto? If we truly want to be ethical, there is a single right answer.