One solution is to only keep a small number of charts in memory at any one time, and to keep reading in the charts on each iteration.
given that the L-BFGS algorithm takes hundreds of iterations to converge, this approach would be infeasibly slow.