[fpc-pascal]StrAlloc and StrDispose of pChars and the like
pasco at acm.org
Wed Nov 14 01:22:44 CET 2001
"Cox, Stuart SRM:EX" wrote:
> Are these two products, BP7 and Delphi 1, talking about the same TYPE?
> BP7 allocate a word sized memory allocation size indicator in memory
> preceding the actual location of the first char of the pChar string?
That's an implementation detail you don't really need to know about.
As long as you pass the same pchar to StrDispose that you got from
StrAlloc, everything should work out.
> not, how does the humble programmer release the same amount of memory as he
> allocated to hold a long string that has become shorter during program
I don't think that you're supposed to edit these strings in place on
the heap, certainly not truncate them by poking nulls into them.
More information about the fpc-pascal