Perl imposes an internal limit (happens to be a signed 16-bit integer on most systems) on the size of various regex operations to limit stack growth. This answer has a very good breakdown of the limit.
From empirical testing, when the space count gets to 32767, that's when you fail, so it's certainly this limit.