Dear all,

I use Delphi 7.0 [Version 8.1].

I am having a problem:

A my multi-thread application which worked for long time, sometimes had some 
fault and in the last period
I could clearly note a memory corruption in a particular simple condition [I 
can replay it but I
still did not find the cause].

Now, my application is having the following behavior:

I just open it and then close it quite soon, just closing the main and only one 
generated form,
so before any thread, except the main one, starts.


On closing, I found out the following finalization units sequence [the last 
three]

System  [third last]
Variant   [second last]
SysUtils [last]

On finalization of SysUtils, the last call DoneExceptions generates an 
exception.
It is on trying to execute the code

OutOfMemory.AllowFree := True;

I noted, since after starting the Application, that the address of variable 
OutOfMemory [EOutOfMemory type]
is $511277D8, containing the pointer-value $0112042C. In fact, in the memory 
around [after] $0112042C
I can note the string 'Out of memory'.

Well, I found out that when the finalization of the unit System calls 
UninitAllocator,
its code

      bd := spaceRoot.next;
      while bd <> @spaceRoot do begin
        VirtualFree(bd.addr, 0, MEM_RELEASE);
        bd := bd.next;
      end;

is such that the memory-address $0112042C is ruled out from the memory space of 
my Application [in fact
also the watch expression PInteger($112042C) switches to return 'Inaccessible 
value'].

So, when the instruction "OutOfMemory.AllowFree := True;" tries to access to 
the bytes around $0112042C, it fails
determining an access violation [really, also the function 
ntdll.KiUserExceptionDispatcher fails to work].

So, the question is:

1) Do you believe it is normal the finalization sequence 
System/Variants/SysUtils ?
2) If yes, do you believe the code calling VirtualFree should not rule out the 
memory of OutOfMemory variable?


While I wait your answers, I will try to check if there is some previous 
corruption on spaceRoot chain.


Thansk for any help.

  ----------

Questa email รจ stata verificata dal sistema centralizzato antivirus della 
UniPlan Software


[Non-text portions of this message have been removed]



------------------------------------

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [email protected]! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/delphi-en/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[email protected] 
    mailto:[email protected]

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/

Reply via email to