Allocate memory in a sufficiently long-lived context.