stream: implement alloc