AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Sprachen und Entwicklungsumgebungen Object-Pascal / Delphi-Language Delphi Speicherleck bei der Verwendung von anonymen Methoden
Thema durchsuchen
Ansicht
Themen-Optionen

Speicherleck bei der Verwendung von anonymen Methoden

Ein Thema von carlo93 · begonnen am 15. Okt 2011 · letzter Beitrag vom 4. Nov 2011
 
Benutzerbild von Stevie
Stevie

Registriert seit: 12. Aug 2003
Ort: Soest
4.049 Beiträge
 
Delphi 10.1 Berlin Enterprise
 
#16

AW: Speicherleck bei der Verwendung von anonymen Methoden

  Alt 20. Okt 2011, 08:04
Antwort von Barry:
Zitat:
When you assign a regular method to a method reference it is actually identical to writing an anonymous method that wraps the method call:

Delphi-Quellcode:
TFooType = reference to procedure(fooArg: TFooArg);
foo: TFooType;

foo := Self.Bar;

foo := procedure(fooArg: TFooArg)
  begin
    Self.Bar(fooArg);
  end;
This captures 'Self' - so you could theoretically find out the instance to which the method reference is referring to, using RTTI tricks - but you would need to disassemble the code of the anonymous method to get to the method itself. If the method is virtual or dynamic, it will be using a different calling mechanism than if it is non-virtual, and similarly it will be more or less obscured.
Stefan
“Simplicity, carried to the extreme, becomes elegance.” Jon Franklin

Delphi Sorcery - DSharp - Spring4D - TestInsight
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 14:10 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz