[SOLVED] Issue with Command Line Application and GetMem? lazarus / 32-Linux ---------------------------------------------------------------------- MathMan · 2016-05-17 09:45 Hi all, Environment: FPC 3.0.0 / Lazarus 1.6.0 / Ubuntu LTE 15.04 Last week I developed a small command line application to address some issues I experienced regarding benchmarking. The tool uses several units I am also using in a general GUI application. So far everything is working fine with one small exception. Some of the routines I want to benchmark allocate scratch memory via GetMem. Every time I try to benchmark these I get unexpected program terminations. Funny thing is that the main command line program is allocating memory too - but here everything seems to work ok. I did of course check that that the units get re-compiled when I compile the command line application. Any ideas? Kind regards, MathMan [Edit:] It is solved but actually I don't know what happened. I spent some time debugging without identification of the root cause which then mysteriously dissapeared. I suspect that even though I tried to make sure that everything gets re-compiled when switching use of some units from the GUI to the command line app something slipped and caused the error. ---------------------------------------------------------------------- marcov · 2016-05-17 10:03 Well, the obvious one, the benchmark program overwrites memory that it shouldn't. range checks, -gtt and valgrind are your friends there. ---------------------------------------------------------------------- MathMan · 2016-05-17 11:10 Quote from: marcov on May 17, 2016, 12:03:30 pmWell, the obvious one, the benchmark program overwrites memory that it shouldn't. range checks, -gtt and valgrind are your friends there. I'll give it a try. Kind regards, MathMan