[fpc-devel] SYSUTILS UTF8String Memory Bug
mark diener
rpzrpzrpz at gmail.com
Sat Aug 9 20:06:02 CEST 2014
I have been getting some pretty strange errors on Lazarus 1.2.4/FreePascal
2.6.4 on windows 8.1 x64
It looks like some internal system memory cache is croaking while waiting
for a free fixed memory chunk.
This is a 2 threaded program using TThread, so the notion of a memory seg
fault while "waiting" means the system cache
is apparently not thread safe.
The code passes thru the SYSUTILS_RIGHTSTR many times before faulting, so
it
I sent another request for anybody to provide a tip at having the stack
trace actually fill in the #1 ?? at :0 entries
in the trace and that would be helpful now.
This is the first time that the problem is squarely inside
system.pas/sysutils.pas on the call stack. There are no other dependencies
like references to global memory, etc.
We clearly have a call to SYSUTILS.rightstr( ).
Here is the stack trace of the memory exception:
#0 SYSTEM_WAITFREE_FIXED$PMEMCHUNK_FIXED$POSCHUNK at :0
#1 ?? at :0
#2 SYSUTILS_RIGHTSTR$ANSISTRING$LONGINT$$ANSISTRING at :0
#3 LEFTPAD(0x4dbf890 'DE26', 4, 48 '0', 0x0) at
C:\pdev\rpzlib\rpzstring.pas:349
#4 RPZCHKSUMPTR4(0x2dc251
'^i'#31'{66h'#7'O'#150#195'n3BD'#166#243#162'~'#188#184#171'7'#218'E'#227'3!v'#206'L'#179'[ENDE26]',
32, 0x0) at C:\pdev\rpzlib\rpzcrc16.pas:69
#5 TRPZUDPFRAME__RXPUMP(100, <error reading variable>) at
C:\pdev\rpzlib\rpzudpframe.pas:401
#6 TRPZUDPSRV__EXECWRAPPER(<error reading variable>) at
C:\pdev\rpzlib\rpzudpsrv.pas:228
#7 TRPZUDPSRV__EXECUTE(<error reading variable>) at
C:\pdev\rpzlib\rpzudpsrv.pas:171
#8 CLASSES_THREADPROC$POINTER$$LONGINT at :0
#9 SYSTEM_THREADMAIN$POINTER$$LONGINT at :0
#10 KERNEL32!CreateWaitableTimerA at :0
#11 ?? at :0
#12 ?? at :0
#13 ?? at :0
#14 ?? at :0
Now when I run the same test using cmem as the memory manager, I get the
following exception violoatoin:
#0 fpc_ansistr_decr_ref at :0
#1 ?? at :0
#2 TAPPLICATION__PROCESSASYNCCALLQUEUE(<error reading variable>) at
.\include\application.inc:1079
#3 TAPPLICATION__IDLE(true, <error reading variable>) at
.\include\application.inc:389
#4 TAPPLICATION__HANDLEMESSAGE(<error reading variable>) at
.\include\application.inc:1273
#5 TAPPLICATION__RUNLOOP(<error reading variable>) at
.\include\application.inc:1405
#6 TWIDGETSET__APPRUN(0x422b50 <TAPPLICATION__RUNLOOP>, <error reading
variable>) at .\include\interfacebase.inc:54
#7 TAPPLICATION__RUN(<error reading variable>) at
.\include\application.inc:1393
#8 main at rpztestudphv.lpr:29
So with the memory manager changed out, the exception now occurs in the GUI
main thread instead of the TThread and clearly the fpc_ansistr_decr_ref
function is failing.
The lines in question in .\include\application.inc:1079 are as follows:
// call event
Event(Data);
This Event variable is a pointer to a function with a single pointer to
integer argument.
Anybody got some ideas about this?
Cheers,
Marco
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140809/e74a519f/attachment.html>
More information about the fpc-devel
mailing list