Changes to prevent random Travis build failures.

Tests seem to get killed on Travis sometimes, perhaps due to going over the 3GB memory limit on Travis.