A bug in Stata causes gtools to exit with error if the user has more than 2^31-1 observations in memory. See this bug report.
I contacted StataCorp about it and they replied:
The SPI can work with datasets containing up to 2^31-1 observations. Our development group is looking into modifying future versions of the SPI to allow more observations.