ENH: add max memmory cost