digitalmars.D - Exception "Access Violation" in calling new()
- Huang Guan (11/11) May 25 2008 I wonder whether I am not familiar with IIRC. It has brought me many tro...
- =?ISO-8859-15?Q?S=F6nke_Ludwig?= (7/25) May 25 2008 I had a similar problem (probably the same). The access violations
- Unknown W. Brackets (10/28) May 25 2008 What is ByteBuffer? A class or struct? Does this ever happen in any of...
- downs (3/18) May 25 2008 This is why we want traced exceptions.
- Jarrett Billingsley (5/31) May 25 2008 I'll reply for Walter:
- BCS (3/14) May 25 2008 and I'll reply for whoever
- Jarrett Billingsley (4/18) May 25 2008 And I'll reply for Walter:
- Robert Fraser (5/24) May 25 2008 (sorry about the web interface)
I wonder whether I am not familiar with IIRC. It has brought me many troubles while I was writing my web server. Of course, muti-threading is used in my server program. In my code, there are a lot of dynamic memory allocations and I am used to using delete function to free the allocated memory. Meanwhile, a big problem occurred to me recently and I got fully lost. Below is the code: ByteBuffer encrypted; try{ encrypted = new ByteBuffer( buf.length ); }catch(Exception e){ dprint("Exception in new ByteBuffer()"); throw e; } In my computer, the code above works well all the time. Then I copied to another computer to run the code. Firstly the exception did not happened. But when my server program worked for a while, it happened. I knew the string value of e.msg is "Access violation" from the console. I didn't know why. I have met the same program a month ago when I was writing another program but soon it disappeared mysteriously. Is there anyone who can give me an answer to this problem?
May 25 2008
Huang Guan schrieb:I wonder whether I am not familiar with IIRC. It has brought me many troubles while I was writing my web server. Of course, muti-threading is used in my server program. In my code, there are a lot of dynamic memory allocations and I am used to using delete function to free the allocated memory. Meanwhile, a big problem occurred to me recently and I got fully lost. Below is the code: ByteBuffer encrypted; try{ encrypted = new ByteBuffer( buf.length ); }catch(Exception e){ dprint("Exception in new ByteBuffer()"); throw e; } In my computer, the code above works well all the time. Then I copied to another computer to run the code. Firstly the exception did not happened. But when my server program worked for a while, it happened. I knew the string value of e.msg is "Access violation" from the console. I didn't know why. I have met the same program a month ago when I was writing another program but soon it disappeared mysteriously. Is there anyone who can give me an answer to this problem?I had a similar problem (probably the same). The access violations occured in a file loader thread at "data = new byte[size];" (with multiple others running in parallel). The workaround I'm using now is to disable the GC around the call to new. Unfortunately I could not reproduce the error in a small testcase so I didn't write a bug report.
May 25 2008
What is ByteBuffer? A class or struct? Does this ever happen in any of your other code, or just there? Does this ever happen when new'ing built-in types? For example, it could be some operation that ByteBuffer is doing in its constructor. Maybe buf.length is 0 or extremely large, or something. Are you using contracts? Are they compiled in? Also - note that access violations are exceptions, but segfaults (same thing on Linux) are not. -[Unknown] Huang Guan wrote:I wonder whether I am not familiar with IIRC. It has brought me many troubles while I was writing my web server. Of course, muti-threading is used in my server program. In my code, there are a lot of dynamic memory allocations and I am used to using delete function to free the allocated memory. Meanwhile, a big problem occurred to me recently and I got fully lost. Below is the code: ByteBuffer encrypted; try{ encrypted = new ByteBuffer( buf.length ); }catch(Exception e){ dprint("Exception in new ByteBuffer()"); throw e; } In my computer, the code above works well all the time. Then I copied to another computer to run the code. Firstly the exception did not happened. But when my server program worked for a while, it happened. I knew the string value of e.msg is "Access violation" from the console. I didn't know why. I have met the same program a month ago when I was writing another program but soon it disappeared mysteriously. Is there anyone who can give me an answer to this problem?
May 25 2008
Huang Guan wrote:I wonder whether I am not familiar with IIRC. It has brought me many troubles while I was writing my web server. Of course, muti-threading is used in my server program. In my code, there are a lot of dynamic memory allocations and I am used to using delete function to free the allocated memory. Meanwhile, a big problem occurred to me recently and I got fully lost. Below is the code: ByteBuffer encrypted; try{ encrypted = new ByteBuffer( buf.length ); }catch(Exception e){ dprint("Exception in new ByteBuffer()"); throw e; } In my computer, the code above works well all the time. Then I copied to another computer to run the code. Firstly the exception did not happened. But when my server program worked for a while, it happened. I knew the string value of e.msg is "Access violation" from the console. I didn't know why. I have met the same program a month ago when I was writing another program but soon it disappeared mysteriously.This is why we want traced exceptions. --downs
May 25 2008
"downs" <default_357-line yahoo.de> wrote in message news:g1c244$2ign$1 digitalmars.com...Huang Guan wrote:I'll reply for Walter: just open it in a debugger and set it to break on access violations! :PI wonder whether I am not familiar with IIRC. It has brought me many troubles while I was writing my web server. Of course, muti-threading is used in my server program. In my code, there are a lot of dynamic memory allocations and I am used to using delete function to free the allocated memory. Meanwhile, a big problem occurred to me recently and I got fully lost. Below is the code: ByteBuffer encrypted; try{ encrypted = new ByteBuffer( buf.length ); }catch(Exception e){ dprint("Exception in new ByteBuffer()"); throw e; } In my computer, the code above works well all the time. Then I copied to another computer to run the code. Firstly the exception did not happened. But when my server program worked for a while, it happened. I knew the string value of e.msg is "Access violation" from the console. I didn't know why. I have met the same program a month ago when I was writing another program but soon it disappeared mysteriously.This is why we want traced exceptions.
May 25 2008
Reply to Jarrett,"downs" <default_357-line yahoo.de> wrote in message news:g1c244$2ign$1 digitalmars.com...and I'll reply for whoever "Run a server app in a debugger?!?"This is why we want traced exceptions.I'll reply for Walter: just open it in a debugger and set it to break on access violations! :P
May 25 2008
"BCS" <ao pathlink.com> wrote in message news:55391cb32d6e88ca8c626d2f304e news.digitalmars.com...Reply to Jarrett,And I'll reply for Walter: --oh wait, Walter wouldn't reply. Nevermind."downs" <default_357-line yahoo.de> wrote in message news:g1c244$2ign$1 digitalmars.com...and I'll reply for whoever "Run a server app in a debugger?!?"This is why we want traced exceptions.I'll reply for Walter: just open it in a debugger and set it to break on access violations! :P
May 25 2008
(sorry about the web interface) I know of two backtrace hacks out there.... - team0xf's (whch requires a runtime replacement) - Flectioned (which requires debug info on Windows, and doesn't play with DDBG, but is easier & less invasive) BCS Wrote:Reply to Jarrett,"downs" <default_357-line yahoo.de> wrote in message news:g1c244$2ign$1 digitalmars.com...and I'll reply for whoever "Run a server app in a debugger?!?"This is why we want traced exceptions.I'll reply for Walter: just open it in a debugger and set it to break on access violations! :P
May 25 2008