Exception "Access Violation" in calling new() -- message to Walter

downs default_357-line at yahoo.de
Sun May 25 08:57:18 PDT 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



More information about the Digitalmars-d mailing list