def METHOD_NAME(self, memory: str):
    if memory := int(memory):
        self.core.lgd.config.set("Legendary", "max_memory", str(memory))
    else:
        self.core.lgd.config.remove_option("Legendary", "max_memory")
    self.core.lgd.save_config()