Memory leak with basic TTree

Well, I would do the following:

sudo apt-get purge "*root*lpc*" # remove any ROOT system package
dpkg --list "*root*lpc*" # make sure all are gone
cd /currently/installed/root/build/subdirectory
sudo xargs rm < install_manifest.txt # remove own ROOT binaries

Then, remove the source and build subdirectories to start everything from scratch.
Finally, download and build the new version (if possible, take the most recent available version).
See also: Sourcing root for all users

Last, but not least … note that the ROOT Team provides ready-to-use binary distributions for “Ubuntu 18 / gcc 7.5”, which you just need to download and unpack (see “Download a pre-compiled binary distribution”).