Re: [Lazarus] Is this a bug?

2017-06-19 Thread Wolf via Lazarus
Now that I learned the word "initialization section", I could google for it, and what's going on behind the screens is no longer murky. Thanks again. I even found the heaptrc documentation and in it the "dumpheap" procedure, which me

Re: [Lazarus] Is this a bug?

2017-06-18 Thread Joost van der Sluis via Lazarus
Op 16-06-17 om 22:58 schreef Wolf via Lazarus: now I understand the real bug is in my assumptions on what goes on behind the screens. But that leads to another question: is there any documentation where I can read up on this so that I may improve on my programming, and particular debugging, ski

Re: [Lazarus] Is this a bug?

2017-06-17 Thread Joost van der Sluis via Lazarus
Op 16-06-17 om 22:58 schreef Wolf via Lazarus: now I understand the real bug is in my assumptions on what goes on behind the screens. But that leads to another question: is there any documentation where I can read up on this so that I may improve on my programming, and particular debugging, ski

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Wolf via Lazarus
Thanks, Mattias and Joost, now I understand the real bug is in my assumptions on what goes on behind the screens. But that leads to another question: is there any documentation where I can read up on this so that I may improve on my programming, and particular debugging, skills? wolf On 16/06

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Joost van der Sluis via Lazarus
On 06/16/2017 11:43 AM, Wolf via Lazarus wrote: If I understand you correctly, because 2. since ParamStr() is handled by the system unit, a call to halt will result in a memory leak because Heaptrc is not aware of this allocation. Only the initialization of the system-unit is done before the h

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Mattias Gaertner via Lazarus
On Fri, 16 Jun 2017 21:43:38 +1200 Wolf via Lazarus wrote: > If I understand you correctly, because > 1. command line parameters are internally treated as a null-terminated > string (i.e. AnsiString), a call to ParamStr() implies a heap allocation > and thus, > 2. since ParamStr() is handled by

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Wolf via Lazarus
If I understand you correctly, because 1. command line parameters are internally treated as a null-terminated string (i.e. AnsiString), a call to ParamStr() implies a heap allocation and thus, 2. since ParamStr() is handled by the system unit, a call to halt will result in a memory leak because

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Mattias Gaertner via Lazarus
On Fri, 16 Jun 2017 20:36:54 +1200 Wolf via Lazarus wrote: > Now I am nicely confused: If halt does call finalization sections, isn't > then all heap space requested by the system unit supposed to be freed as > well? The system unit is special. It is loaded even before the heap manager is init

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Wolf via Lazarus
Now I am nicely confused: If halt does call finalization sections, isn't then all heap space requested by the system unit supposed to be freed as well? I do have observed at times that some, and sometimes even all heap space requested by the system unit, does get freed when calling halt. So, wh

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Ondrej Pokorny via Lazarus
On 16.06.2017 9:33, Mattias Gaertner via Lazarus wrote: On Fri, 16 Jun 2017 09:25:24 +0200 Ondrej Pokorny via Lazarus wrote: On 16.06.2017 9:12, Wolf via Lazarus wrote: If the call to "halt;" is commented out, there is no memory leak reported. Is this intentional? Yes, halt kills the program

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Mattias Gaertner via Lazarus
On Fri, 16 Jun 2017 09:25:24 +0200 Ondrej Pokorny via Lazarus wrote: > On 16.06.2017 9:12, Wolf via Lazarus wrote: > > If the call to "halt;" is commented out, there is no memory leak > > reported. Is this intentional? > > Yes, halt kills the program without finalizing anything. No code is >

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Mattias Gaertner via Lazarus
On Fri, 16 Jun 2017 19:12:31 +1200 Wolf via Lazarus wrote: > The following program produces these two memory leaks: > > Heap dump by heaptrc unit > 2 memory blocks allocated : 188/208 > 0 memory blocks freed : 134/144 > 2 unfreed memory blocks : 54 > True heap size : 32768 > True free heap :

Re: [Lazarus] Is this a bug?

2017-06-16 Thread Ondrej Pokorny via Lazarus
On 16.06.2017 9:12, Wolf via Lazarus wrote: If the call to "halt;" is commented out, there is no memory leak reported. Is this intentional? Yes, halt kills the program without finalizing anything. No code is executed afterwards. Everything that is allocated at the time Halt is executed result