[fpc-pascal] Problems with GetMem

Jonas Maebe jonas.maebe at elis.ugent.be
Sun Apr 10 00:24:11 CEST 2011


On 10 Apr 2011, at 00:20, <dhkblaszyk at zeelandnet.nl> <dhkblaszyk at zeelandnet.nl> wrote:

> I get strange errors when using GetMem. In my
> app I keep on allocating and freeing memory in a variable. At a certain
> moment I do keep getting a SIGSEGV on the GetMem call when trying to
> allocate exactly 128bytes. However allocating other sizes seems to work
> just fine. Is there some logical explanation what could be going on
> here?

Most likely it's memory corruption: writing into a freed memory block, writing outside the bounds of an allocated memory block, ... Compiling with -gh may help pinpoint it, and if not and you're on a Unix-based platform, you can try Valgrind.


Jonas




More information about the fpc-pascal mailing list