Ok, so I'm writing an airline simulator thingy. I have a database for the program to use in order to collect its data to run the simulation.
I have an object called GlobalRoute and an object called Route. A GlobalRoute contains the historical data from the database and some data about how things have changed for the current running simulation.
I also have an object called Airport, that contains the IATA code, State, Coordinates, Country, ect.
The problem I am having is I am running into memory walls when I attempt to import the data from the database. The memory wall is consistently being hit at the same time, which is while it is reading in the GlobalRoutes. There are 95324 GlobalRoutes that it needs to read into the program. That seems to be a tad much for the computer to handle, so I am trying to make my GlobalRoute objects as memory efficient as possible, as far as variables go, to hopefully allow me to read in more objects.
My current design is as follows:
A GlobalRoute object contains the following class variables:
Airport Origin - Reference to Memory which contains an Airport Object
Airport Destination - Reference to Memory which contains an Airport Object
int Distance - Ranges from 2 to 9363
double PAX - Ranges from 0 to 3174.84
int Fare - Ranges from 0 to 2995
int Revenue - Ranges from 0 to 786598
double ConnPAX - Ranges from -3174.84 to INF (theoretically INF, but in reality a really large number that I don't know what it is)
double ConnRev - Ranges from 0.0 to INF
double CurrentlyServedPAX - Ranges from 0.0 to ConnPAX
Vector<Route> routeList - Vector of References to Route Objects, size ranges 0 to INF
Vector<Company> companies - Vector of References to Company Objects, size ranges 1 to INF
DecimalFormat df - Decimal Format Object for Stylistic Formatting
DecimalFormat d2 - Decimal Format Object for Stylistic Formatting
boolean beenFixed - boolean for checking
I have currently capped off the number of GlobalRoutes that it reads in to 4182 to prevent any possible memory problem while reading in and to still provide plenty of memory to run with. I would like to be able to read them all in though, since what I currently have is only 4% of what I need.
Are there any suggestions for what I can do to make things more memory efficient?