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

Jarrett Billingsley kb3ctd2 at yahoo.com
Sun May 25 09:28:29 PDT 2008


"downs" <default_357-line at yahoo.de> wrote in message 
news:g1c244$2ign$1 at digitalmars.com...
> 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.

I'll reply for Walter:

just open it in a debugger and set it to break on access violations!

:P 





More information about the Digitalmars-d mailing list