SB1 2007A DI Memory leak?
I've got a DI application containing the code fragment below. It contains a loop that loads an item, then loops through the price lists and updates a specific pricelist.
It seems that every time the loop runs about 1MB of is added to the SAP Business One process. If the loop runs long enough, SAP B1 runs out of memory.
Is there anyway to perform a large number of DI operations in a loop without the memory leak?
Items ITM = (Items)B1Connections.diCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oItems);
Items_Prices Prices = null;
for (int i = 0; i < gvPriceList.DataRowCount; i++)
B1Data.dtItemPricesRow row = (B1Data.dtItemPricesRow)gvPriceList.GetDataRow(i);
Prices = ITM.PriceList;
for (int j = 0; j < Prices.Count ; j++)
if (Prices.PriceList == int.Parse(PriceList_Purch))
Prices.Currency = row.Currency;
Prices.Price = (double)row.NettPurchasePriceForeign;
This is a pretty big memory leak using this object.
What patch of Business One are you using? There was an issue fixed in 2007A PL37 (Note 1151766).
I would recommend logging a message for SAP support to report this leak.