|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Ansistring not being freed on Halt(1)I'm chasing an issue with a program I have that is leaving an Ansistring unfreed on exit. It exists
cleanly without using halt(), but this is the the only way I've managed to reproduce it. Should Halt() leave memory unfreed? It is only reproducible if I use ExtractFileName or ExtractFileExt.. (which is what the block trace points to in my program also) This is the 2.2 Fixes svn branch as of 26/9/2008. Program TestAnsi; {$mode objfpc}{$H+} Uses SysUtils; Var T1, T2 : String; Begin T1 := '123456789.fred'; T2 := ExtractFileName(T1); Halt(1); End. brad@bklaptop2:~/temp$ fpc -gh -gl atest.pas Free Pascal Compiler version 2.2.3 [2008/09/26] for i386 Copyright (c) 1993-2008 by Florian Klaempfl Target OS: Linux for i386 Compiling atest.pas Linking atest 16 lines compiled, 0.3 sec brad@bklaptop2:~/temp$ ./atest Heap dump by heaptrc unit 7 memory blocks allocated : 78/96 6 memory blocks freed : 55/72 1 unfreed memory blocks : 23 True heap size : 65536 True free heap : 65440 Should be : 65456 Call trace for block $B7F69048 size 23 $0804F29F NEWANSISTRING, line 64 of /home/brad/devel/fpc/svn/fixes/fpc/rtl/inc/astrings.inc $0806392F EXTRACTFILENAME, line 98 of /home/brad/devel/fpc/svn/fixes/fpc/rtl/objpas/sysutils/fina.inc $080480D9 main, line 10 of atest.pas $0807B187 _FPC_PROC_START, line 72 of ./i386/si_prc.inc Regards, Brad -- Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish. _______________________________________________ fpc-pascal maillist - fpc-pascal@... http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
|
|
Re: Ansistring not being freed on Halt(1)On Mon, Sep 29, 2008 at 11:19 AM, Brad Campbell <brad@...> wrote:
> I'm chasing an issue with a program I have that is leaving an Ansistring > unfreed on exit. It exists cleanly without using halt(), but this is the the > only way I've managed to reproduce it. > > Should Halt() leave memory unfreed? I remember from a few months back, I was fighting the same battle. Halt() is very nasty! It abruptly stops application execution with no clean-up as far as I know. Nothing after a Halt() call gets executed. So I stopped using it. Regards, - Graeme - _______________________________________________ fpGUI - a cross-platform Free Pascal GUI toolkit http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-pascal maillist - fpc-pascal@... http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
|
|
Re: Ansistring not being freed on Halt(1)Graeme Geldenhuys wrote:
> On Mon, Sep 29, 2008 at 11:19 AM, Brad Campbell <brad@...> wrote: >> I'm chasing an issue with a program I have that is leaving an Ansistring >> unfreed on exit. It exists cleanly without using halt(), but this is the the >> only way I've managed to reproduce it. >> >> Should Halt() leave memory unfreed? > > I remember from a few months back, I was fighting the same battle. > Halt() is very nasty! It abruptly stops application execution with no > clean-up as far as I know. Nothing after a Halt() call gets executed. > So I stopped using it. Ok, all well and good.. but then how does the heaptrace run? In addition, if I comment out the Extractxxx() call then it always cleanly frees it's memory, halt or no. I only use Halt() in the event of a fatal error in any case here, but I'm stumped with this string not being freed in my app when I'm _not_ using halt. I was using the unix units before with BaseDir() and Dirname() without issue, but I needed to go cross-platform so I converted to the Sysutils calls ExtractXXX(), which is when the problem arose. Regards, Brad -- Dolphins are so intelligent that within a few weeks they can train Americans to stand at the edge of the pool and throw them fish. _______________________________________________ fpc-pascal maillist - fpc-pascal@... http://lists.freepascal.org/mailman/listinfo/fpc-pascal |
| Free Forum Powered by Nabble | Forum Help |