added getTop() for malloc()