AW: AW: AW: [fpc-devel] MemoryLeak with AS Operator

Jonas Maebe jonas.maebe at elis.ugent.be
Mon Aug 14 13:12:14 CEST 2006


On 14 aug 2006, at 13:06, Helmut Hartl wrote:

> If memory is acquired through:
>
> "Getmem(x,size)"
> and Freed through
> "Freemem(x,size)"
>
> I have a leak because Getmem reserves occasionally
> more mem as specified in size?

No. Well, it will round up all allocations to a multiple of X bytes  
(X depends on whether you're on a 32 or 64 bit platform), but the  
same happens when freeing. If you free with a wrong size, you get a  
run time error 204.

> Is
> "Getmem(x,size)" Freemem(x) correct?

Yes.

> Is valgrind support broken or do
> I have to do something beyond setting the valgrind compiler switch?

You don't have to do anything but compile all your program's units  
and the program itself with the -gv switch.


Jonas



More information about the fpc-devel mailing list