Quantcast

Maximum PC

It is currently Tue Sep 30, 2014 8:04 am

All times are UTC - 8 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: My program produces C0000005 exception...
PostPosted: Thu Mar 31, 2005 7:20 pm 
8086
8086

Joined: Thu Jul 22, 2004 2:16 pm
Posts: 74
I recently had a major project in my AP CS class, and the version i turned in was acceptable for what it was sposed to do, but sometimes it just randomly crashes. It produces a C0000005 exception, which apparently is a nuffer overflow error. I have no idea how it does this, except that it does run through small strings (length between 4-8 ) many many many times (linked lists up the ass, like 4000 nodes) that it creates and recreates in iterations, searching for patterns.

Is there any trick i can do to help find where the hell this error is coming from? Besides occuring in the algorithm with seemingly arbitrary parameters, it will also occur if the same operation is run with the exact same input and output files and parameters several times in a row. Could it be that i just suck so much at programming that i dont know how to do a garbage collect or to clean the buffer? Are there simply too many linked lists or is my algorithm flawed?

Any help greatly appreciated...

PS, i can give source code to any that care, but its too long to post here

EDIT:
exception shows memory address 0x00403CC0 if thats any help
language is c++, compiled in codewarrior


Top
  Profile  
 
 Post subject:
PostPosted: Thu Mar 31, 2005 9:03 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
A c...5 error is a memory access violation error.

This is often caused by:
1. Use of non-initialized NULL pointers
2. Use of pointers after calling delete on them
3. Buffer overflow

It is pretty much impossible to tell you your problem without seeing your code. Please post it.

EDIT:
The best way to find where the error is coming from is to use your debugger.

Failing that, use the poor man's debugger: std::cout statements in every section to narrow down the line(s) where the error originates from.


Top
  Profile  
 
 Post subject:
PostPosted: Sat Apr 02, 2005 5:51 pm 
8086
8086

Joined: Thu Jul 22, 2004 2:16 pm
Posts: 74
i've done the cout thing :)
Its my favorite method just cause no one ever taught us how to use the debugger.

if anyone could point me towards a good codewarrior tutorial, that would be a great help.

As for posting my code, i'd rather not, its like 40 pages, and its impossible to understand unless you thoroughly understand the algorithm. I feel sorry for my teacher, who has to grade it.

basically, it is sposed to compress text files in a simulation of bits. As and Bs are used as bits.
1) It reads a file into a linked list where each node just contains a char and an int.
2) it is given a pattern length to search for. It divides the list into each section of that length. So a file of 1000 characters would be divided into 250 patterns, and put in a pattern list (which is basically just a list of chars within each pattern node)
3) It searches through each pattern to find which ones match. the matching ones are given a matching reference number, or index.
4) all distinct patterns are written to a new file in the order that they were indexed.
5) the list of indexes is written.
so basically heres a sample:
input: AAABBBAABAABAAABBB
give a length of 3, and here is output:
AAA
BBB
AAB
1
2
3
3
1
2
some other numbers are written to help decode this, including length of patterns, number of distinct patterns, and number of total patterns.

if you would like to look at the entire code, email me... MunkiRench@gmail.com

thanks for all your help...


Top
  Profile  
 
 Post subject:
PostPosted: Sat Apr 02, 2005 6:36 pm 
Team Member Top 100
Team Member Top 100

Joined: Fri Sep 17, 2004 5:35 pm
Posts: 1176
Ah, I understand what you're doing. It's pretty similar to a huffman alogorithm.

I'll email you, and we can talk via AIM or MSN...


Top
  Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

© 2014 Future US, Inc. All rights reserved.