Re: no access violation ?
- From: "Skybuck Flying" <nospam@xxxxxxxxxxx>
- Date: Wed, 19 Oct 2005 21:37:07 +0200
Ok, I am a bit confused...
Do access violations happen because the operating system issue's/creates
them or because some delphi system issue's/creates them or both ?
I think something like this probably happens:
1. TSomeObject.create... is called
2. Delphi's memory manager requests memory from the operating system.
3. The memory is used to create/store the object in etc.
4. The object is destroyed
5. The memory of the object is returned to delphi's memory manager.
6. Delphi's memory manager keeps this memory "alive" for fast recycle etc
(?) like a buffer pool ;)
So had the memory be returned to the operating system an access violation
would have occured ?
So why then does the delphi system not issue an access violation ? <- argh,
so tiring ;) lol, probably for speed reasons eh ? ;)
Anyway this could mean that when the delphi memory manager is replaced with
a "simple" memory manager which simply returns the memory to the operating
system an access violation would then occur ?
Bye,
Skybuck.
"Jamie" <jamie_5_not_valid_after_5_Please@xxxxxxxxxxx> wrote in message
news:kCg5f.18967$1X5.4681@xxxxxxxxxxx
> Skybuck Flying wrote:
>
> > Hi,
> >
> > I wanted to test something by causing an access violation. To my
surprise
> > this code does not produce an access violation, why is that ?
> >
> > program Project1;
> >
> > {$APPTYPE CONSOLE}
> >
> > uses
> > SysUtils;
> >
> > type
> > Ttest = class
> > public
> > mField : integer;
> >
> > procedure Test; virtual;
> > end;
> >
> > procedure Ttest.Test;
> > begin
> > writeln('mField is: ', mField );
> > end;
> >
> >
> > var
> > vTest : Ttest;
> >
> > begin
> > vTest := Ttest.Create;
> >
> > vTest.Test;
> >
> > vTest.Destroy;
> >
> > vTest.Test;
> >
> > writeln('press enter to exit');
> > readln;
> > end.
> >
> > Bye,
> > Skybuck.
> >
> >
> it's because the memory that was recently freed for the object is
> still valid only because you haven't yet done anything else that would
> cause a request for some memory which would then alter that state of the
> memory.
> this is way many people find out they have buggy programs when moving
> from the 9x kernel over to the start of W2k and up. memory being freed
> was thus used rite a way again starting with W2k where is before that,
> memory freed was just placed at the bottom of the pile and new memory
> requested was talking from the top of the pile..
> i guess you could say that W2k and up has a LIFO buffer and the
> 9x kernel has a LILO buffer.
>
>
> --
> Real Programmers Do things like this.
> http://webpages.charter.net/jamie_5
>
.
- Follow-Ups:
- Re: no access violation ?
- From: Bruce Roberts
- Re: no access violation ?
- References:
- no access violation ?
- From: Skybuck Flying
- Re: no access violation ?
- From: Jamie
- no access violation ?
- Prev by Date: The window does not have scroll bars..
- Next by Date: Re: Is it possible to cancel a destruction ?
- Previous by thread: Re: no access violation ?
- Next by thread: Re: no access violation ?
- Index(es):
Relevant Pages
|