Add LArrayBuilder test and fix the timing of calling free