Add memory stack tracing to API