I don't know how to find out, for certain, if this is the function that's causing the garbage collection error, but my gut tells me it is. The error occurs when I load the next scene to run the script on. I have over a hundred scene files I need to run the script on. I'm currently having to shut Max down between scene files, which sucks.
I've tried adding gc() at the end of the function I believe to be the culprit, but that doesn't seem to have helped, I still the get error when I open the next scene file.
At this point I'm looking for suggestions of more surgical methods to avoid these sorts of errors. I've read the help doc's pages on memory management and garbage collection, which is good information. Also, this thread seems helpful:
Bobo's comment about "Possible causes: getting a mesh value inline or again and again without deleting it manually after the use, incremental string and array appending operations, bitmap value definitions inside the loop etc." has me interested in learning how to perform some of these manual operations to manage the memory profile for the script.