correction to get_required_mem