[fpc-pascal] Interface, _AddRef, _Release, etc.

Marcos Douglas md at delfire.net
Thu Sep 15 22:08:56 CEST 2011


On Thu, Sep 15, 2011 at 4:45 PM, Marcos Douglas <md at delfire.net> wrote:
>
> Yeah, you're right... I didn't see this link.  =)
> But see it one more time: the R instance of TRealClass is not
> released... saw? I didn't test but I think if R was released will
> occur an AV.

As I said, if we use R.Free...

W:\dev\tests\interfaces\p2>p2.exe
Using regular interfaces
TBaseObject DoAll !
Got interface OK. Calling it
THook Doing something !
TBaseObject DoAll !
Integer GMax:56
Double GMax: 5.65000000000000E+001

An unhandled exception occurred at $2D414635 :
EAccessViolation : Access violation
  $2D414635
  $00406802  TOBJECT__FREE,  line 165 of W:/md/dev/freepascal/compiler/2.4.5/rtl
/inc/objpas.inc

Heap dump by heaptrc unit
59 memory blocks allocated : 1227/1440
55 memory blocks freed     : 1107/1320
4 unfreed memory blocks : 120
True heap size : 229376 (112 used in System startup)
True free heap : 228832
Should be : 228888
Call trace for block $0006D1B8 size 64
  $00408168  REALLOCMEM,  line 303 of W:/md/dev/freepascal/compiler/2.4.5/rtl/in
c/heap.inc
  $00407301  fpc_raiseexception,  line 196 of W:/md/dev/freepascal/compiler/2.4.
5/rtl/inc/except.inc
  $00412C75  RUNERRORTOEXCEPT,  line 369 of W:/md/dev/freepascal/compiler/2.4.5/
rtl/objpas/sysutils/sysutils.inc
  $00407C5E  HANDLEERRORADDRFRAME,  line 901 of W:/md/dev/freepascal/compiler/2.
4.5/rtl/inc/system.inc
  $00406802  TOBJECT__FREE,  line 165 of W:/md/dev/freepascal/compiler/2.4.5/rtl
/inc/objpas.inc
  $0040BAA1  EXE_ENTRY,  line 376 of system.pp
Call trace for block $00056340 size 24
  $00407301  fpc_raiseexception,  line 196 of W:/md/dev/freepascal/compiler/2.4.
5/rtl/inc/except.inc
  $00412C75  RUNERRORTOEXCEPT,  line 369 of W:/md/dev/freepascal/compiler/2.4.5/
rtl/objpas/sysutils/sysutils.inc
  $00407C5E  HANDLEERRORADDRFRAME,  line 901 of W:/md/dev/freepascal/compiler/2.
4.5/rtl/inc/system.inc
  $00406802  TOBJECT__FREE,  line 165 of W:/md/dev/freepascal/compiler/2.4.5/rtl
/inc/objpas.inc
  $0040BAA1  EXE_ENTRY,  line 376 of system.pp
Call trace for block $000562E0 size 16
  $00412A87  RUNERRORTOEXCEPT,  line 349 of W:/md/dev/freepascal/compiler/2.4.5/
rtl/objpas/sysutils/sysutils.inc
  $00407C5E  HANDLEERRORADDRFRAME,  line 901 of W:/md/dev/freepascal/compiler/2.
4.5/rtl/inc/system.inc
  $00406802  TOBJECT__FREE,  line 165 of W:/md/dev/freepascal/compiler/2.4.5/rtl
/inc/objpas.inc
  $0040BAA1  EXE_ENTRY,  line 376 of system.pp
Call trace for block $00056220 size 16
  $00401796  main,  line 104 of p2.lpr
  $0040BAA1  EXE_ENTRY,  line 376 of system.pp
  $00407924  fpc_initializeunits,  line 753 of W:/md/dev/freepascal/compiler/2.4
.5/rtl/inc/system.inc
  $0040BAA1  EXE_ENTRY,  line 376 of system.pp

W:\dev\tests\interfaces\p2>



More information about the fpc-pascal mailing list