In general, the operating system imposes some “user limits”. Try:
[bash]$ ulimit -S -a
[bash]$ ulimit -H -a
[tcsh]$ limit
[tcsh]$ limit -h
If any application, while running, exceeds any of these limits, it will be killed.
I can imagine that your program eats more and more “resources” while running. For example, if there’s a “memory leak” somewhere in the procedure that fills your histograms, then the RAM usage will increase with every new event … and finally it may even exceed the total RAM amount of your machine.
Try to run “top” (observe the “VIRT” / “RES” / “SHR” / “%MEM” fields), in another terminal window, in order to find how much resources your program is actually using while running.