473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

access violation error for push_back on a vector

i have a class PCB,

vector <PCB> ready;
vector <PCB> blocked;

if(!blocked.empty())
{
class PCB testx;
testx=blocked[0];
if(testx.ioprocess==2)
{
//remove from blocked Q and put onto ready Q
init_readyQ(testx);
blocked.erase(blocked.begin());
}
}

and init_readyQ is

void OS::init_readyQ(class PCB test)
{
cout << "In init_readyQ" << endl;
VA=getchar();
test.em=0;
test.EM="";
test.si=0;
test.lines=0;
test.ioprocess=0;
test.init_swapper();
ready.push_back(test);
cout << "Out of init_readyQ" << ready.size() <<endl;
return;
};

i am calling init_readyQ from other places also. but the init_readyQ fails somtimes when i am tryign to call it from the above mentioned code. I don't understand what i am doign wrong :(
Nov 19 '06 #1
3 3291
horace1
1,510 Expert 1GB
suggest printing out some information about vector ready and PCB test in case they are corrupt. what does function test.init_swapper(); do? could it cause the problem?
Nov 19 '06 #2
vector ready is empty and PCB test is comping off another vector of the same type as ready.. init_swapper initialises some variables in PCB

suggest printing out some information about vector ready and PCB test in case they are corrupt. what does function test.init_swapper(); do? could it cause the problem?
Nov 19 '06 #3
horace1
1,510 Expert 1GB
vector ready is empty and PCB test is comping off another vector of the same type as ready.. init_swapper initialises some variables in PCB
I doubt if it is vector as it has been around for a long time and is well tested. What compiler / operating system are you using (have you tried a different one) ? what is the actual error? could you post all the code ?
Nov 20 '06 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Allen | last post by:
Hi all, I tried posting to one of the ms.win32 groups and haven't gotten a response yet. It may be my C++ that's at fault anyway so I'll try here too. I wrote a .dll that is misbehaving...
3
by: Eric Boutin | last post by:
Hi ! I got the fallowing function : void pushargv(TmpFile in) { std::string tmp = in.getfilename(); argv.push_back(in.getfilename()); tocleanup.push_back(in.getfilename());} where argv...
1
by: Avery Fong | last post by:
The following program will result in a compile error when building under Debug but will compile under Release. Why does is work under Release mode but not under Debug This program is developed...
3
by: zombek | last post by:
Hi. I'm quite a begginer. I wanted to learn the usage of tinyxml library so I wrote a little program which compiles on g++ 4.1.1 with -O2 -Wall, but when I run it a get a message "memory access...
1
stealwings
by: stealwings | last post by:
I have implemented a binary search and some other functions to my code, when I compile it, it gives me no error, but when I run it, it gives me an Access violation, why? Can some one explain me plz....
6
by: hadad.yaniv | last post by:
Hello, i am new to c++, i hav a vector of typed object: vector<Man*People; When i do a second pushback, even for the same object the program crash say: "An Access Violation (Segmentation...
4
by: tuxman | last post by:
Hi all. First of all let me apologize by my english. I've googled a lot about my problem, but I had not find anything conclusive. I have the following piece of code: vector < map < int , char *...
0
by: Paavo Helde | last post by:
Shawn <sfncook@gmail.comwrote in news:6410e273-318e-44a0-9735-b922366ca1ab@w1g2000prd.googlegroups.com: I bet you have some multithreading access error. Ensure that your threads do not read or...
2
by: fgh.vbn.rty | last post by:
Hi, I'm not sure if i'm asking the question correctly but anyway here it is. Say I have 3 classes - class A, class B, class R. 1) A and B are the building blocks and R is like a repository...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.