improve trace; add allocate