AW: Speicherproblem mit Objekten in DLL
@BastiFantasti , Hi
For me this behavior looks like dangling pointers (by-copy), this of course will leads to memory leak but not exactly as traditional just not-freed. So my thoughts here: 1) you can increase the stack reported by FastMM for the leaks by adjusting a constant in FastMM4.pas to something like 30, it might help, or you can use EurekaLog as it will report the leaks with far more accuracy, as i can't see if the record (you mentioned in the second post) in the report, did it leak too ? 2) the most crucial thing is to check and then double check, how these record and objects being passed to the DLL, i mean how did you declare the parameters for these managed types or that record, are these "const" or "var" or left as default without modifier, each one will behave differently and this might cause this copy, hence increasing the ref count causing this leak. 3) are doing any sort of casting on managed type or that record? is it passed by pointer or as const ? you can also track its refCount (or any of its managed type field) in memory before calling from the EXE and compare on the DLL after that call. Hope that helps. |
AW: Speicherproblem mit Objekten in DLL
Zitat:
|
AW: Speicherproblem mit Objekten in DLL
Das Problem ist behoben.
Es war ein nicht freigegebenes JSON Objekt bei der Objektserialisierung. Für die anderen, die auch in diese Verlegenheit kommen:
Code:
Hier hatte ich vergessen das TJsonObject freizugeben :oops:
var
jo: System.Json.TJsonObject; begin try jo := rest.Json.TJson.ObjectToJsonObject(aObject); Result := jo.Format(DEF_JSON_INDENT); finally freeandnil(jo); end; end; d.h. der Fehler war nicht bei Delphi zu suchen, sondern 40cm vor dem Bildschirm. |
AW: Speicherproblem mit Objekten in DLL
Hallo,
hätte FastMM4 nicht wenigstens das Objekt anzeigen müssen? |
AW: Speicherproblem mit Objekten in DLL
Zitat:
Klar, wenn man es dann erst weiß, ist es total logisch, auch dem Threadersteller. Aber wie es halt so ist... wenn man sucht und sucht, in die falsche Richtung schaut, ... Wem ist es noch nicht so ergangen? Mir auf jeden Fall schon oft. Wichtig ist, dass man daraus lernt, so dass man beim nächsten Mal weniger lange sucht. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 01:59 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz