[fpc-pascal] Ansistring not being freed on Halt(1)

Brad Campbell brad at wasp.net.au
Mon Sep 29 13:16:37 CEST 2008


Graeme Geldenhuys wrote:
> On Mon, Sep 29, 2008 at 11:19 AM, Brad Campbell <brad at wasp.net.au> 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.



More information about the fpc-pascal mailing list