Error in Code

What do I do when the backtest fails and it says in the console, "Memory usage exceeded maximum limit."


  • ptunneyptunney Posts: 246

    It sounds like you are running out of memory!!!

    There is a limited amount of memory allocated to each backtest on a per day basis.

    So like any computer program, if you do not constrain your actions you will run out of memory.

    What exactly are you trying to do?

    The most common reason for running out of memory is trying to collect too much data..

    How many symbols are you running on, have you tried running with a smaller symbol universe to see if it works?

    As an example, you can run all symbols, each trading multiple times per day without issue, or you can trade a smaller universe and collect data. But if you try to do both, trading 8000+ symbols, multiple times per day, and collecting lots of data every time... you will run out of memory.

    Also, consider that your backtest memory is for the whole "docker' - a simulated computer, one spun up for each backtest day, so anything you do can consume that memory, for example if you are also printing a lot to the console or writing to a file (the file is held in memory and once the backtest finishes and the 'machine' that ran that day is closed down, then the file is written to the actual file system), those are consuming memory in that "simulated machine".

    So if you bear these things in mind you can work without running out of memory.

Sign In or Register to comment.