Collapse of program due to allocation problems with MultiPathGenerator

Posted by LotharK on
URL: http://quantlib.414.s1.nabble.com/Collapse-of-program-due-to-allocation-problems-with-MultiPathGenerator-tp7083.html

Dear all,

I am currentlly using all "ingridients" of the testSwaptionPricing method of libormarketmodel.cpp from the testsuite. My aim is to simulate 40-50 forward rates according to the way it's done in libormarketmodel.cpp. Therefore, all I have changed are the variables Size size from 10 to 40 and Size steps from 8*size to 10*size.
Now I am experiencing allocation problems due to the MultiPathGenerator. The reason for that is probably the number of elements simulated by the generator: The method "PseudoRandom::make_sequence_generator" has to simulate size*(grid.size()-1) normally distributed random numbers. In my case 40*(400-1) = 15960.
Now I am considering nrTrails = 5000 (number of trajectories). This makes in total: 15960*5000 = 79.800.000 elements at once.
Could that be the reason for the collapse of my problem throwing a malloc exception?

Generally speaking, I think it would be much more efficient if we simulated trajectories just for one grid step (theoretically possible since increments of Brownian motions are independent), we could recover and save the forward rates for this step and then overwrite the sample_type path with the trajectories of the next grid step.
Has anybody tried something like that before or experienced the same problems?

I am a beginner with Quantlib and I would really appreciate any kind of help. I haven't found something about my issue in the forum. If there already exists sth. I apologize and thank in advance for the link.

Cheers,
Lothar