I am using Qt Creator version 5.0.0 beta to write my code, with MSVC2010 with SP1 and all updates applied to compile.
I am creating a vector of objects that I have defined to store meta information about the jobs at my surveying firm.
I am storing the following information in this structure with variable type then variable name;
#pragma once
#ifndef JOB_H
#define JOB_H
#include "surveyman.h"
#include "client.h"
#include "contact.h"
#include "job.h"
#include "legallocation.h"
#include "location.h"
#include <string>
#include <time.h>
#include <QDate>
using namespace std;
class job
{
public:
job();
job(int newUI, int newJobNumber, string newAddendum, string newJobType,
string newDevelopmentName, QDate newDateReceived, string newNotes,
legalLocation newJobLocation, client newCustomer, int newTotalMoneyPaid)
;
static int uniqueIdentifier;
int jobNumber;
private:
int UI;
string addendum;
string jobType;
string developmentName;
QDate dateReceived;
string notes;
legalLocation jobLocation;
client customer;
int totalMoneyPaid;
};
#endif // JOB_H
#pragma once
#ifndef LOCATION_H
#define LOCATION_H
#include <string>
using namespace std;
class location
{
public:
location();
location(string, string, string, string, string, int, string, string, string);
string getAddressLine1();
void setAddressLine1(string);
string getAddressLine2();
void setAddressLine2(string);
string getAddressLine3();
void setAddressLine3(string);
string getAddressLine4();
void setAddressLine4(string);
string getLocality();
void setLocality(string);
string getStreet2();
void setStreet2(string);
string getAdditionalStreets();
void setAdditionalStreets(string);
string getAdditionalLocalities();
void setAdditionalLocalities(string);
int getUI();
int getPostCode();
void setPostCode(int);
string toString();
string getProvince(int);
static int uniqueIdentifier;
private:
int UI;
string addressLine1;
string addressLine2;
string addressLine3;
string addressLine4;
string locality;
int postCode;
string street2;
string additionalStreets;
string additionalLocalities;
};
#endif // LOCATION_H
#pragma once
#ifndef LEGALLOCATION_H
#define LEGALLOCATION_H
#include "location.h"
#include <string>
#include <vector>
using namespace std;
class legalLocation : public location
{
public:
legalLocation();
legalLocation(location basicLocoation, vector<vector<int> > folios);
legalLocation(string, string, string, string, string, int, string,
string, string, vector<vector<string> >);
vector<vector<string> > getFolios();
private:
vector<vector<string> > folios;
};
#endif // LEGALLOCATION_H
#pragma once
#ifndef CLIENT_H
#define CLIENT_H
#include "location.h"
#include "legallocation.h"
#include <string>
#include "contact.h"
using namespace std;
class client
{
public:
client();
client(string, string, string, string, string, location, vector<contact>);
client(int, string, string, string, string, string, location, vector<contact>);
static int uniqueIdentifier;
private:
int UI;
string lastName;
string firstName;
string phone;
string fax;
string emailAddress;
location address;
vector<contact> contacts;
};
#endif // CLIENT_H
#pragma once
#ifndef CONTACT_H
#define CONTACT_H
#include <string>
using namespace std;
class contact
{
public:
contact();
contact(string, string, string, string);
static int uniqueIdentifier;
private:
int UI;
string firstName;
string lastName;
string phone;
string emailAddress;
};
#endif // CONTACT_H
When I import the jobs, which takes a lot of code to get the information from one quite unstructured format, into this format I have noted three things about using vector.push_back(temporaryJob) [actual code is jobsDatabase.push_back(tempJob);]
When it reaches 5395 jobs added to the vector the program stops working and gives the standard microsoft “program has stopped responding” window.
When I create a second vector object and add to it once the first vector has 5000 objects stored in it the second vector object reaches a size of 711 before the same error occurs.
When using the same code for the two vector objects and upping the limit to 5350 the second file reaches 474 before the warning appears.
There might be several problems at the same time :