<div dir="ltr"><div><div>Jonas:<br><br></div><div>I am working on the heaptrc and DrMemory analysis today.<br></div><div><br>Switching to range checks (-CRr) begins a new round of code changing to handle compile errors as shown by example below.<br>
<br></div><div>How would you begin to clean up the code so that range checks <br></div><div><br></div><div>Your response appreciated,<br><br></div><div>Marco<br></div><div><br><br>************************************<br><br>
</div><div>For example:<br><br></div><div>Compile Error Message:<br></div><div><br>C:\pdev\rpzlib\rpzopsyswin32.pas(46,37) Error: range check error while evaluating constants<br><br></div><div>Offending code:<br></div><div>
<br></div>nres := ioctlsocket(socket,FIONBIO,@nblock) ;<br><br></div>So my FIONBIO constant is triggering a compile time error.<br><br>From winsock2.pas:<br><br>const<br> FIONBIO = ULONG(IOC_IN or { set/clear non-blocking i/o }<br>
((Longint(SizeOf(Longint)) and IOCPARM_MASK) shl 16) or<br> (Longint(Byte('f')) shl 8) or 126);<br><br>function ioctlsocket( const s: TSocket; cmd:
Longint; argp: pu_long ): Longint; stdcall;external WINSOCK2_DLL name
'ioctlsocket';<br><div><br><br><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Aug 9, 2014 at 3:34 PM, Jonas Maebe <span dir="ltr"><<a href="mailto:jonas.maebe@elis.ugent.be" target="_blank">jonas.maebe@elis.ugent.be</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On 09/08/14 20:06, mark diener wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
So with the memory manager changed out, the exception now occurs in the<br>
GUI main thread instead of the TThread and clearly the<br>
fpc_ansistr_decr_ref function is failing.<br>
<br>
The lines in question in .\include\application.inc:1079 are as follows:<br>
<br>
// call event<br>
Event(Data);<br>
<br>
This Event variable is a pointer to a function with a single pointer to<br>
integer argument.<br>
<br>
Anybody got some ideas about this?<br>
</blockquote>
<br></div>
Your program probably contains a memory corruption bug that messes up the heap state. To find it, you can try enabling range and class type checking (-CRr) and enabling heaptrc (-gh), or using the C memory manager and running the program through Dr Memory (<a href="http://www.drmemory.org" target="_blank">http://www.drmemory.org</a> )<br>
<br>
<br>
Jonas<br>
______________________________<u></u>_________________<br>
fpc-devel maillist - <a href="mailto:fpc-devel@lists.freepascal.org" target="_blank">fpc-devel@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel" target="_blank">http://lists.freepascal.org/<u></u>cgi-bin/mailman/listinfo/fpc-<u></u>devel</a><br>
</blockquote></div><br></div>