AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

String MemoryLeak

Ein Thema von dinosaur · begonnen am 20. Aug 2010 · letzter Beitrag vom 23. Aug 2010
 
dinosaur

Registriert seit: 6. Dez 2004
16 Beiträge
 
#1

String MemoryLeak

  Alt 20. Aug 2010, 15:37
Delphi-Version: 2010
FastMM meldet mir einige Memorleaks (Ansistrings), aber ich verstehe nicht, weshalb diese auftreten

logfile:
This block was allocated by thread 0xFDC, and the stack trace (return addresses) at the time was:
4047E2 [System][System.@GetMem]
407788 [System][System.@NewAnsiString]
4077D7 [System][System.@LStrFromPCharLen]
D87FE4 [TwixApi.pas][Twixapi][Twixapi.TTwixapi.GetMainEntry][1070]
77773B97 [RtlNtStatusToDosError]
77773B9C [RtlNtStatusToDosError]
75946A96 [Unknown function at InterlockedCompareExchange]
7594CC66 [Unknown function at SizeofResource]
7594CA61 [FindResourceExW]
7594CA61 [FindResourceExW]
76EA2BB4 [Unknown function at GetSysColorBrush]

The block is currently used for an object of class: AnsiString

dies ist die entsprechende stelle im Code. Zeile 1070 ist die Zuweisung des Results.

Delphi-Quellcode:
function TTwixapi.GetMainEntry(ID_MainEntry: Integer): AnsiString;
var
   pTmpStr: Array[0..1023] of AnsiChar;
begin
   if TwixGetMainentry(ID_MainEntry, @pTmpStr[0], 1024) then
   begin
      result := AnsiString(pTmpStr);
   end;
end;
eine 2. Variante resultiert ebenfalls im selben memoryleak:

Delphi-Quellcode:
function TTwixapi.GetMainEntry(ID_MainEntry: Integer): AnsiString;
var
   pTmpStr: PAnsiChar;
begin
   result := '';
   pTmpStr := AnsiStrAlloc(1024);
   pTmpStr[0] := #0;
   try
      if TwixGetMainentry(Index, ID_FollowEntry, pTmpStr, 1024) then
      begin
         result := pTmpStr;
      end;
   finally
      StrDispose(pTmpStr);
   end;
end;

auf aufgerufenen Funktionen habe ich keinen einfluss, TwixGetMainentry stammt aus einer DLL.
Kann mich jemand auf den richtigen Weg lotsen?
  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 06:14 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 by Thomas Breitkreuz