GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 28-Jul-2004, 09:16
gmn gmn is offline
Junior Member
 
Join Date: Aug 2003
Posts: 33
gmn is on a distinguished road
Unhappy

access violation


"Access Violation"
This is apparently whats causing my application to crash without warning.

Sorry if this a vague post but I've not got much to go on really. The code compiles with no errors or warnings, and the program works fine for hours on a good day, but at times it will crash almost immediately.

This is an mp3 jukebox app using MSVC++ app wizard. A typical scenario is as follows:

launch program...
File -> Open -> Play -> (program crashes, "access violation")
- relaunch program -
File -> Open -> Play -> (plays tune, playlists load/save, all is ok...)

Usually crashes when opening/playing a song but I cant think why....it doesnt do anything elaborate and works most the time.

So, what is an access violation? And how do you go about finding the problem....
is there something that often causes this?

Does MSVC++ have any tools to help find the problem? (Pressing debug when it crashes gives a VERY long list of asm add instructions, nothing helpful (to me at least)).

Sorry if this is too general a question but I've not had this problem before.

Thanks for you're time.
  #2  
Old 04-Aug-2004, 01:51
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 889
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
Quote:
Originally Posted by gmn
Sorry if this is too general a question but I've not had this problem before.

Well, this means you are a very good programmer (it happened to me )

Quote:
Originally Posted by gmn
"Access Violation"

So, what is an access violation? And how do you go about finding the problem....
is there something that often causes this?


Well, you usually get this when you try to use some resurses you "don't have" (like memory).
Unfortunately, this also occurs because of some bugs in VC6 - try installing the most recent Service Pack (whichever that would be) if you hadn't already done so.

For example, _sometimes_ when you open a Visual C++ generated makefile, you get this error (sometimes it works just fine!) - Microsoft has confirmed this to be a bug, and fixed it in .NET

Also, I would recomend using asserts in your code, especially when using pointers, arrays, and other resurses (like sound files!) .
It is possible you "sometimes" try to use memory past the one allocated ...

If you use malloc it allocates a few bytes before and after (I think!) the buffer it assignes to your program. If you write over those bytes, the data structures of malloc get corrupted and the next time you call malloc it fails and generates a Segmentation Fault (Access Violation).

Well, you didn't give much to go on ... so I can't really give you anything helpfull... sorry

Hope you fix this sucker

Luci
  #3  
Old 04-Aug-2004, 04:31
gmn gmn is offline
Junior Member
 
Join Date: Aug 2003
Posts: 33
gmn is on a distinguished road
A response! I thought this forum was dead, along with some others I tried.....

Well, there has been a lot of responses to this on codeguru.com, see http://www.codeguru.com/forum/showthread.php?t=304102&page=3 if you're interested.

I've pretty much given up on this.....the amount of help I've had and time I've put in to getting this one problem fixed is getting beyond a joke. But if anyones got any pearls of wisdom just waiting to be shared about access violations (I'm not writing past an array, believe me - its been checked by others too) the code is posted on this site, along with about 30 responses - but its still doing exactly the same thing. Aaaaarrrhhhhh!

Its a shame cus I've now pretty much wasted a month but there you go......
  #4  
Old 04-Aug-2004, 06:19
LuciWiz's Avatar
LuciWiz LuciWiz is offline
Moderator
 
Join Date: Jul 2004
Location: Cluj-Napoca (Romania)
Posts: 889
LuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the roughLuciWiz is a jewel in the rough
I've read (most) of the replyes you got there - they make perfect sense, I'm sorry they didn't solve your problem....
Unfortunatelly, I don't really have much time right now (I'm at work ), but I see your problem is with CString; I have some (bad ) experience with MFC and CString : see http://support.microsoft.com/default...b;EN-US;193100 for some reference....
I don't see any deletes in your code, so this probably isn't the problem, but...
Anyway, I promise to look on your code some other time, and if I get a brainstorm, I'll let you know....

Offtopic: I just thought this was kind of funny:

Quote:
Originally Posted by gmn
it __crashes perfectly well__ without this


Hope you don't mind, you are probably pretty depressed right now...

P.S: Try posting here http://forum.softpedia.com/forumdisplay.php?forumid=73

It's a romanian site, but you can post in English; the guys are pretty good (they helped me), but you'll probably need to register first (it's free).

Link to off topic messages.
Last edited by JdS : 04-Aug-2004 at 10:06. Reason: inserted link to split thread
 

Recent GIDBlogFirst week of IA training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
apache server cannot access through another machine benluo Apache Web Server Forum 0 13-Jul-2004 19:28
Text Doc to Access DB calculus87 CPP / C++ Forum 18 21-May-2004 00:41
access local webserver from the local host calisro Apache Web Server Forum 1 10-May-2004 08:53
Urgernt: Extremely queer Apache access log moothecow Apache Web Server Forum 1 20-Dec-2003 02:45
FREE 25 MB, No Ads, Control Panel, ASP, ColdFusion, PHP, MySQL, Access Hosting rkmails Free Web Hosting 0 08-Sep-2003 05:49

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 19:48.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.