Do you have a Skill development license? If so, you can profile the performance and memory usage of your program:
Click on Skill Profiler
From the profile menu, you can choose "Start Profiling Time" or "Start Profiling Memory".
After the profiler has started, run your program. Since it is currently crashing Cadence, you'll want to run a smaller data set, or even ctrl-c to cancel the command before you crash.
When your run has finished, press the "Stop" button on the profiler form (the square) and you'll see some information about the top memory users or time users.
Press the Browse button (looks like a tree) and it will build a tree of your code to help you see your memory usage in your code hierarchy.
Then examine the profile results to help pin point your memory hog. If you are able to get this far and isolate the problem code, then post it and we can help you improve it.
If you don't have the profiler, you might want to post a sample of your code.