Hi All,

I am somewhat confused here and would need some assistance on how to fix this issue. The code runs for some time and crashes at some point. This problem occurs when I have a larger workload on the code. It works well for small loads.

The error returned is:

First chance exception 0xC0000005 ACCESS_VIOLATION occurred at 0x00427D77, write of address 0x00000008 at 0x00427D77

on line

return conjCodis;

I have read some stuffs on the access violation thing, pointing to the pointers. I am unable to fix mine. Thanks for your help.

vector<double> Place::addMark(Arbre *mark, double cod)
{
	vector<double> conjCodis;

	Arbre tokAux = *mark;
	map<Arbre,vector<double> ,ltstr>::iterator pos = marcatges.find(tokAux);
	if(pos!=marcatges.end())
	{
		mark = const_cast<Arbre*> (&((*pos).first));
		conjCodis = marcatges[*mark];

		marcatges[*mark].push_back(cod);
	}
	else
	{
		marcatges[*mark].push_back(cod);
	}
	return conjCodis;
}
Salem commented: Well done on using code tags on your first post +36

Recommended Answers

All 5 Replies

> return conjCodis;
Did you conclude it stopped here by using a debugger?

Yes, I used the debugger to confirm that.

Good, so now use the debugger to examine your program state to try and figure out how it got into that state to begin with.

Then you can think about what code changes are needed to stop it from getting into the error state.

commented: Yes +22

Okay, I will do that and get back to you asap

You do realize that conjCodis never gets a value when you jump in the 'else' part of your code right?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.