Validates_associated memory issue

I have a basic script on a RoR site that parses a set of data and adds
it to my DB. At the end of the script I save a collection of
ActiveRecord objects. This innocuous-looking piece of code was eating
up memory at an alarming rate - up to 1.5 GB of memory. It turns out
the culprit was a “validates_associated” validation.

Has anyone experienced this before? My understanding of ruby’s garbage
collection is limited, but is it possible that the objects used in the
validation are not freed until the script is done? If so, why not?

Any help would be appreciated.

Thanks,
AR