Exception "Access Violation" in calling new()
Huang Guan
love203a at yahoo.com.cn
Sun May 25 00:38:22 PDT 2008
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?
More information about the Digitalmars-d
mailing list