Add memory check

Suppoted memory check on travis-ci when cmake is used.