The error message that I get sequentially:
Invalid memory access for location 0x8 rip = 0x10cf4ab28
What I am doing is making a basic backtesting verification system that iterates huge arrays of stocks / historical data using various algorithms using java + eclipse on the latest Mac OS X.
I tracked down the code that seems to be calling it. The method that is used to get massive data arrays is called thousands of times. Nothing has been preserved, so I donโt think there is a memory leak. However, it seems that the set limit is about 7000 times, I can iterate over it before I get a memory error.
It is strange that it works fine in debug mode. Does anyone know which debug mode works differently in Eclipse?
Providing jvm with more memory doesn't help, and it seems to work just fine using -xint. And again, it works fine in debug mode.
public static List<Stock> getStockArray(ExchangeType e){ List<Stock> stockArray = new ArrayList<Stock>(); if(e == ExchangeType.ALL){ stockArray.addAll(getStockArray(ExchangeType.NYSE)); stockArray.addAll(getStockArray(ExchangeType.NASDAQ)); }else if(e == ExchangeType.ETF){ stockArray.addAll(etfStockArray); }else if(e == ExchangeType.NYSE){ stockArray.addAll(nyseStockArray); }else if(e == ExchangeType.NASDAQ){ stockArray.addAll(nasdaqStockArray); } return stockArray; }
A simple loop like this, repeated more than 1000 times, will cause a memory error. But not in debug mode.
for (Stock stock : StockDatabase.getStockArray(ExchangeType.ETF)) { System.out.println(stock.symbol); }
source share