<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
I totally understand, but I did not discover the problem until<br>
I was well into a larger project that I could not de-construct<br>
to try to generate a reproducible sample.<br>
<br>
I am under a time pressure, decided to start using using LAZ/FPC
about 3 months ago,<br>
and when I starting running the program under load, it started to
die.<br>
<br>
So I cleaned up my string function calls, separated out the pchar
calls,<br>
and things just magically healed themselves.<br>
<br>
The program passes ALL of my load testing and just keeps running.<br>
<br>
Do not ask me to reproduce it since I cannot<br>
and I do not dispute that in a single threaded <br>
test application, that it works.<br>
<br>
The problem is when you start building up a large pile of code<br>
and then start up the high volume testing, things really show
themselves.<br>
<br>
The problem in this particular case is the the GDB back trace on
segment fault was total garbage,<br>
so I cannot use that to tell you where the bug is.<br>
<br>
Trust me, I am putting my financial basis into the binary output<br>
of the FPC compiler since I can produce a much larger quantity of
code faster<br>
for LInux and Mac than I can with GCC/Xcode.<br>
<br>
But for those like me, this serves as a warning to pay attention to
this aspect.<br>
<br>
There is not some underlying instability, but I believe a certain
combination of things<br>
causes a pointer reference that is off into la-la land.<br>
<br>
My problems were in Copy( ) and PosEx( ), nothing more.<br>
<br>
You guys rock!<br>
<br>
md<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<div class="moz-cite-prefix">On 6/11/2013 9:03 AM, Antonio Fortuny
wrote:<br>
</div>
<blockquote cite="mid:51B73C48.2010709@sitasoftware.lu" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
Hi Folks.<br>
<br>
I don't know how Jeppe is playing around but because I want to
make sure FPC works preoperly I decided to take some time to see
what happens<br>
Yhis is the code snippet I use in Win32 and Linux x86_64<br>
All are Lazaur 1.0.8<br>
<br>
Put the code under a TButton and send results to a TMemo:<br>
<br>
procedure TFrmMain.BtnTestClick(Sender: TObject);<br>
var<br>
P: Integer;<br>
str: String;<br>
pc: PChar;<br>
len: Integer;<br>
begin<br>
str := '<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://bcms.webdev.tralala.com/testudf.php?action=goodanswer">http://bcms.webdev.tralala.com/testudf.php?action=goodanswer</a>';<br>
len := Length(str);<br>
P := PosEx('bcms', str, 3);<br>
Memo1.Lines.Add(Format('search "bcms" in %s: position %d', [str,
P]));<br>
pc := nil;<br>
ReAllocMem(pc, len + 1);<br>
Move(PChar(str)^, pc^, len);<br>
pc[len] := #0;<br>
P := PosEx('bcms', pc, 3);<br>
Memo1.Lines.Add(Format('search "bcms" in %s: position %d', [str,
P]));<br>
end;<br>
<br>
I've made the test with a PChar too<br>
<br>
TMemo.Lines shows:<br>
search "bcms" in <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://bcms.webdev.tralala.com/testudf.php?action=goodanswer">http://bcms.webdev.tralala.com/testudf.php?action=goodanswer</a>:
position 8<br>
search "bcms" in <a moz-do-not-send="true"
class="moz-txt-link-freetext"
href="http://bcms.webdev.tralala.com/testudf.php?action=goodanswer">http://bcms.webdev.tralala.com/testudf.php?action=goodanswer</a>:
position 8<br>
<br>
which, obviously looks correct. That's what I expect since more
than 15 years (beginning with Delphi and Pos function)<br>
<br>
Enjoy,<br>
<br>
Antonio.<br>
-- <br>
<div class="moz-signature">
<table
style="font-family:'Calibri','sans-serif';font-size:8.0pt;color:#002f87;border:0;width:auto;">
<tbody>
<tr>
<td style="vertical-align:bottom;padding:40px 20px
25px;border-top:1pt solid #BFBFBF;"> <img alt="Sita
Software"
src="cid:part4.02070706.08040806@rpzdesign.com"> </td>
</tr>
<tr>
<td style="vertical-align: top; padding: 5px 20px 0;"> <b>Antonio
Fortuny</b><br>
Senior Software engineer<br>
<br>
220, avenue de la Liberté<br>
L-4602 Niederkorn<br>
Tel.: +352 58 00 93 - 93<br>
<a moz-do-not-send="true"
style="color:#002f87;cursor:pointer;text-decoration:
none;" href="http://www.sitasoftware.lu">www.sitasoftware.lu</a><br>
</td>
</tr>
<tr>
<td style="padding:20px 20px 30px;border-bottom: 1pt solid
#BFBFBF;" align="right"> <img alt="Your IT Partner"
src="cid:part6.00000300.07060502@rpzdesign.com"> </td>
</tr>
</tbody>
</table>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a></pre>
</blockquote>
<br>
</body>
</html>