Re: no access violation ?



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
>


.



Relevant Pages

  • Re: If Macs have no spyware....
    ... >had made a complete code review of its operating system and removed all ... and writing new data into those memory locations would ... >but when the data exists on the stack, it can cause very large problems. ... >location that needs to be written in place of the correct execution ...
    (comp.sys.mac.advocacy)
  • Re: If Macs have no spyware....
    ... First you yammer about being a Mac advocate, then bad mouth me for dumping XP in favor of a Mac. ... Supposedly Microsoft had made a complete code review of its operating system and removed all the buffers which could overflow. ... the fundamental problem is that the basic architecture of Windows has two fatal flaws in its memory management and while these remain in the software the ad hoc patches will never be enough to make Windows a secure operating system. ... These problems are bad enough when dealing with data in the one routine but when the data exists on the stack, it can cause very large problems. ...
    (comp.sys.mac.advocacy)
  • Re: [Lit.] Buffer overruns
    ... > floating point support or a memory expansion option. ... had virtual memory support grafted on. ... > where the modified instruction was fetched from. ... vis-a-vis the official coporate strategic operating system TSS/360. ...
    (sci.crypt)
  • Re: PDP11 Memory Mangement
    ... used for data and there is less physical memory than ... even though many programs did require overlays - such ... what I accept as paging since the same program addresses ... having worked with and helped to design an operating system ...
    (comp.sys.dec)
  • Re: no access violation ?
    ... Delphi's memory manager requests memory from the operating system. ... > So had the memory be returned to the operating system an access violation ... > So why then does the delphi system not issue an access violation? ...
    (alt.comp.lang.borland-delphi)