Hello,

I would like to use custom data such as `SECReport10K` in my algorithms, but I get an out of memory exception as soon as I use more than a few handful of securities.

I add the data with `AddData`.

Is there anything I should do to free memory when the security is removed from the universe, or is custom data unsubscription taken care of automatically?
 

Has anybody had better luck?
Looking forward to your thoughts.

 

public override void Initialize()
{
    SetStartDate(2018, 1, 12);  //Set Start Date
    SetCash(100000);             //Set Strategy Cash
    AddUniverse(Universe.DollarVolume.Top(50)); // creashes already with 30 or less

}

public override void OnData(Slice data)
{
    foreach (BaseData baseData in data.Values.Where(sym => sym.Symbol.IsCustomDataType<SECReport10K>())) {
        Debug($"{Time}: {baseData}");
    }
}


public override void OnSecuritiesChanged(SecurityChanges changes)
{
    base.OnSecuritiesChanged(changes);
    foreach (Security security in changes.AddedSecurities) {
        AddData<SECReport10K>(security.Symbol);
    }
    // foreach (Security security in changes.RemovedSecurities) {
    //     .. is there something we should do to remove custom data?
    // }

}