|
|
Home » Community » Newbie corner » Segmentation Error, Assertion failed BiCont.h
|
Re: Segmentation Error, Assertion failed BiCont.h [message #52725 is a reply to message #52724] |
Thu, 14 November 2019 11:39   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Hello Xemuth,
Quote:
hat head method is used for ? do it concern only Vector or Array use it aswell ?
BiVector and BiArray are basically "bidirectional containers" that can act like queues (FIFO or LIFO). 
A head is basically the first element of that queue (BArray or BiVector). The same as vector[0];
A tail is basically the last element of that queue (BiArray or BiVector). the same as vector[vector.GetCount() - 1];
Api docs explain BiVectors and BiArrays. Here is an excerpt:
They "allows adding elements at both sides of sequence in constant amortized time."
T& Head() { ASSERT(items > 0); return vector[start]; }
This means that your code is calling the Head method of a BiVector or BiArray in somewhere in your code, but the container appears to be empty at the time of call. Hence the assertion. 
Can you confirm my point of view : Upp calling Head before Doing any action on a Vector that could raise a crash ?
Probably. Because, as I pointed out above, the assertion you've got is a result of calling the Head method of an empty container.
Have you some tips and trick to do propper code and prevent all this Boards effect that can be raised by a bad usage of Vector ?
Bounds checking or using IsEmpty() method, where appropriate, can save your time. 
Also check those containers whether they are picked or not. (Calling the Head method of a picked vector is illegal).
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Thu, 14 November 2019 11:54] Report message to a moderator
|
|
|
|
Re: Segmentation Error, Assertion failed BiCont.h [message #52727 is a reply to message #52726] |
Thu, 14 November 2019 12:11   |
Oblivion
Messages: 1206 Registered: August 2007
|
Senior Contributor |
|
|
Quote:
However, I still got a blurred vision on why when my code running, the first 2 hours is ok, but after a long time this error will randomly spawn like one of my vector Have been emptied but my programme dont do that once. have you never encounter this kind of "case" ?
Hard for me to say...
If you are using containers extensively, you'll eventually gain a habit of checking them at some point. 
Possible clue: Do you use threads? If so, does this vector is shared between threads. or not local in any way? Then it might be a problem with thread access, in which case the thread is spawning before initialization or population of that vector. (i.e. a synchronization issue maybe?)
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
upp-components: https://github.com/ismail-yilmaz/upp-components
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Thu, 14 November 2019 12:14] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Tue May 13 14:23:40 CEST 2025
Total time taken to generate the page: 0.00830 seconds
|
|
|