I doubt your are running out of memory, just overflowing the buffer that contains the list of input files.
Unfortunately the input form expands every featureclass to the full path. I am guessing that you have excessively long paths so you will have a buffer length of say 100 x 100 characters = 10,000 chars which is more than a likely 8K block limit in the code.
This was a problem when we used sys.argv[] to pass parameters, and the arcpy.getParameter is supposed to be unlimited.
You could test this by making your paths much smaller.
I always write my scripts to set a folder and a wildcard string, and then assemble the list of files without the full path in the script.
Then set the workspace to the folder to execute the merge. Saves specifying the list in the input form, which is more general, but a nuisance for a special case.
I have found other limits merging rasters, max 20 at a time. In that case I did a staged merge.
First merge all the images in a row, then merge the rows into a block, then merge the blocks.
It was easy to do from the names of the image tiles which had a good pattern. Works much faster too.