Not storing the p4 sync results is the part that would require me to rewrite large portions of the tek42 code. It's built into how the library deals with output from all perforce commands, not just the sync code. All the output is stored, then parsed, then split, then parsed again. Certainly not efficient when you have over 2 million files being synced at once like some people seem to have. We would need to rewrite it so it would use a buffered stream that's provided to all levels of abstraction simultaneously, which would also likely require multithreading. A quick hack would be to throw out all output when 'sync' is in the command line, but then you would have the unfortunate side effect of not having any feedback if something goes wrong.
The tek42 library simply wasn't designed to handle large operations like this, but given that the official p4java doesn't work correctly on all platforms, it's the best we've got.
It would only take ~20mb if it was pure data. The tek42 libraries also make a copy of it and split it into an array of lines. At the end of the day, it could be taking up as much as 3 or 4 times the amound of ram you would normally expect. Depending on the JVM you are using, the default max heap size value could be as low as 64mb-128mb, so that would easily fill it up in no time. We run with -Xmx2000m, and have never run into this issue.
Getting this fixed is on my list of things to do, but I'm getting slammed at work and haven't had much time for OSS at the moment.