Exception "Access Violation" in calling new()
Unknown W. Brackets
unknown at simplemachines.org
Sun May 25 02:55:34 PDT 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?
>
>
More information about the Digitalmars-d
mailing list