Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-07

heaptrc on win98

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Vincent Snijders

Hi,

I found another incompatibility between windows 98 and windows 2000. When I use heaptrc on lazarus or the examples, it crashes with an access violation. On windows 2000 there is no problem.

The crash takes place in the WindowProc function in win32callback.pp. Recently a TLMInsertText variable was added. It contains an ansistring, which means an exception block is added to the function and also some memory from the heap is located.

On windows 2000, no access violation is created, but heaptrc reports that not all memory is released:
Heap dump by heaptrc unit
146 memory blocks allocated : 592/1184
146 memory blocks freed : 584/1168
0 unfreed memory blocks : 8
True heap size : 262144 (80 used in System startup) True free heap : 261936
Should be : 262048

Shall I report this to the fpc buglist? It can be shown to happen also in a slightly modified version of the winhello demo program shipped with fpc.

Vincent.

Reply by email

Florian Klaempfl
to Vincent Snijders
Vincent Snijders wrote 24 lines
Hi, I found another incompatibility between windows 98 and windows 2000. When I use heaptrc on lazarus or the examples, it crashes with an access violation. On windows 2000 there is no problem. The crash takes place in the WindowProc function in win32callback.pp. Recently a TLMInsertText variable was added. It contains an ansistring, which means an exception block is added to the function and also some memory from the heap is located. On windows 2000, no access violation is created, but heaptrc reports that not all memory is released: Heap dump by heaptrc unit 146 memory blocks allocated : 592/1184 146 memory blocks freed : 584/1168 0 unfreed memory blocks : 8 True heap size : 262144 (80 used in System startup) True free heap : 261936 Should be : 262048 Shall I report this to the fpc buglist? It can be shown to happen also in a slightly modified version of the winhello demo program shipped with fpc.

Ansistrings deallocated in the exit code of the main program are handled improperly by the heaptrc unit because the check for unreleased blocks is done before these strings are deallocated.

Reply by email

Vincent Snijders
to Vincent Snijders: I found another incompatibility between windows 98 and windows 2000. When I use heaptrc…
Show quoted text 30 lines
Vincent Snijders wrote: > Hi, > > I found another incompatibility between windows 98 and windows 2000. > When I use heaptrc on lazarus or the examples, it crashes with an > access violation. On windows 2000 there is no problem. > > The crash takes place in the WindowProc function in > win32callback.pp. Recently a TLMInsertText variable was added. It > contains an ansistring, which means an exception block is added to > the function and also some memory from the heap is located. > > On windows 2000, no access violation is created, but heaptrc reports > that not all memory is released: > Heap dump by heaptrc unit > 146 memory blocks allocated : 592/1184 > 146 memory blocks freed : 584/1168 > 0 unfreed memory blocks : 8 > True heap size : 262144 (80 used in System startup) > True free heap : 261936 > Should be : 262048 > > Shall I report this to the fpc buglist? It can be shown to happen > also in a slightly modified version of the winhello demo program > shipped with fpc. Ansistrings deallocated in the exit code of the main program are handled improperly by the heaptrc unit because the check for unreleased blocks is done before these strings are deallocated.

That is not the problem. Even allocating a longint and de-alocating it immediately afterwards with new and dispose in the winproc function, causes this problem. I think it has to do with creating the caller address from this callback (I suspect it crashes in get_caller_addr).

Reply by email