[fpc-pascal] Heaptrc with symbolic stack trace or map file on Mac OS X ?
Hello, I'm trying to find a memory leak but I am unable to get a symbolic stack trace from the heaptrc dump. Also the option -Xm does not generate a map file on Mac OS X. Or at least I don't see it. If I could get a detailed map file with line numbers and offsets, I would probably be happy. Any ideas? Thanks. Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Heaptrc with symbolic stack trace or map file on Mac OS X ?
On 25 Oct 2010, at 11:33, Tobias Giesen wrote: I'm trying to find a memory leak but I am unable to get a symbolic stack trace from the heaptrc dump. Automatically symbolicating stack traces is currently only supported when using Stabs debug information on Mac OS X (make sure to also compile with -gl to include the symbolication unit). Also the option -Xm does not generate a map file on Mac OS X. Or at least I don't see it. It's indeed not implemented for Mac OS X. You can manually tell the linker to create it by passing the following options to FPC: -k-map -kmapfilename.map If I could get a detailed map file with line numbers and offsets, I would probably be happy. It's probably easier to either (temporarily) switch to Stabs debug information, or to compile with DWARF debug info and then script gdb to convert the addresses to line numbers: First convert a backtrace to gdb commands: sed -e 's/^ \$/info line *0x/' trace.gdb (paste the backtrace) and then press ctrl-d Then have gdb execute the commands: gdb executable_name -batch -x trace.gdb E.g.: $ ./tt6 Heap dump by heaptrc unit 1 memory blocks allocated : 10/16 0 memory blocks freed : 0/0 1 unfreed memory blocks : 10 True heap size : 327680 (16 used in System startup) True free heap : 327568 Should be : 327584 Call trace for block $000C2060 size 10 $2578 $25A0 $25C4 $00031F68 $2530 $2240 $B104 $ sed -e 's/^ \$/info line *0x/' trace.gdb $2578 $25A0 $25C4 $00031F68 $2530 $2240 $B104 $ gdb tt6 -batch -x trace.gdb Reading symbols for shared libraries .. done Line 6 of tt6.pp starts at address 0x2578 TEST+24 and ends at 0x2588 P$PROGRAM_TEST+40. Line 11 of tt6.pp starts at address 0x25a0 TEST2+16 and ends at 0x25b0 PASCALMAIN. Line 15 of tt6.pp starts at address 0x25c4 PASCALMAIN+20 and ends at 0x25d8 main. Line 300 of ../bsd/system.pp starts at address 0x31f68 FPC_SYSTEMMAIN+88 and ends at 0x31f7c SYSTEM_FPC_SYSTEMMAIN$LONGINT $PPCHAR$PPCHAR+108. No line number information available for address 0x2530 _start+748 No line number information available for address 0x2240 start+48 No line number information available for address 0xb104 Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Range checking in a for loop
On Mon, 25 Oct 2010 01:06:16 -0700 (PDT), leledumbo wrote about [fpc-pascal] Range checking in a for loop: [snip] program test; var a: array [1..3] of Integer; i: Integer; begin for i := 1 to 4 do a[i] := i; end. The compiler will accept this code happily, despite the fact that there's an out of bounds array index when i = 4. There is no reason in the for-loop construct that i cannot have the value 4; it is only a problem when i is used as a subscript on the array a. Try declaring i : 1..3; instead, as that range matches the array's bounds. You should then get a range check at compile time. It is also the idiomatic Pascal way of doing this. -- Regards, Dave [RLU #314465] === david.w.n...@ntlworld.com (David W Noon) === signature.asc Description: PGP signature ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Range checking in a for loop
On 25 Oct 2010, at 13:24, David W Noon wrote: Try declaring i : 1..3; instead, as that range matches the array's bounds. You should then get a range check at compile time. With current released versions, you won't get such a compile time error. I fixed that just yesterday in svn though (r16213). Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Widestring memory leaks with FPC 2.4.0?
Hello, I'm using FPC 2.4.0 on Mac and I have a problem with WideString memory leaks. Is there any known issue, such that temporary WideStrings are not always freed, or any bug in reference counting? Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
On 25 Oct 2010, at 14:53, Tobias Giesen wrote: I'm using FPC 2.4.0 on Mac and I have a problem with WideString memory leaks. Is there any known issue, such that temporary WideStrings are not always freed, or any bug in reference counting? No. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
Hi, I am doing a regular heaptrc.DumpHeap now and I see that WideString memory blocks are still allocated for string values which are no longer in use. Is the memory freed in some lazy way? Or should a value that is no longer assigned to any WideString be freed immediately? Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] TPLY
I recently saw a semi working example of a Java to Delphi converter that was done with javacc. Unfortunately it would only convert simple java (v 1.4 maybe). Can anyone recommend a good place to start reading or offer any advise to accomplish this with TPLY. I am looking into porting some Java libraries to FPC 2.5.x, and am unfamiliar with the TPLY tools. Thanks, Brian ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
On 25 Oct 2010, at 19:08, Tobias Giesen wrote: I am doing a regular heaptrc.DumpHeap now and I see that WideString memory blocks are still allocated for string values which are no longer in use. Is the memory freed in some lazy way? Or should a value that is no longer assigned to any WideString be freed immediately? There can always be hidden temps around. Unless heaptrc shows leaks when the program exits, no memory leaks happen. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
Unless heaptrc shows leaks when the program exits, no memory leaks happen. It's a leak. The program loses hundreds of MBs of memory just by working with WideStrings. I compared it against FPC 2.2.4 - no leak. An SVN snapshot of 2.5.1 from around 3 months ago also leaks. Will update from SVN now. Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
In our previous episode, Tobias Giesen said: Unless heaptrc shows leaks when the program exits, no memory leaks happen. It's a leak. The program loses hundreds of MBs of memory just by working with WideStrings. I compared it against FPC 2.2.4 - no leak. An SVN snapshot of 2.5.1 from around 3 months ago also leaks. Note that on Windows 2.2.4 has the Kylix widestring, while 2.4.0 and later have a COM widestring. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
On 25 Oct 2010, at 20:35, Tobias Giesen wrote: It's a leak. The program loses hundreds of MBs of memory just by working with WideStrings. I compared it against FPC 2.2.4 - no leak. Then you'll have to provide a compilable example that demonstrates the problem so we can fix it. Jonas___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring memory leaks with FPC 2.4.0?
Then you'll have to provide a compilable example that demonstrates the problem so we can fix it. I will try! Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Widestring Questions
Hi, is it possible to turn off reference counting, for a test? Is there a difference between UnicodeString and WideString on the Mac version (i386) of FPC 2.4 / 2.5? Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring Questions
On 25 Oct 2010, at 23:25, Tobias Giesen wrote: is it possible to turn off reference counting, for a test? No. Is there a difference between UnicodeString and WideString on the Mac version (i386) of FPC 2.4 / 2.5? No. UnicodeString and WideString only differ on Windows. Jonas ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring Questions
Hi, I think the problem might be that Widestring reference counting is not thread safe. But it worked fine in FPC 2.2. I will add some UniqueString calls and also try to isolate the issue. Cheers, Tobias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] Cross-compiling with FPC 2.5.1
I use the scripts buildcrossbinutils.sh and buildcrosssnapshot.sh to buils the FPC 2.4.2 cross compiler (linux to win32). However when I do the same steps but with FPC 2.5.1, I get the following error: make all LINKSMART=1 CREATESMART=1 make[4]: Entering directory `/home/me/Programs/fpc/fpsrc/2.5.1/packages/hermes' /home/me/Programs/fpc/cross_fpc/cross/bin/i686-cygwin-as --32 -o units/i386-win32/mmx_clr.o src/i386/mmx_clr.as make[4]: /home/me/Programs/fpc/cross_fpc/cross/bin/i686-cygwin-as: Command not found make[4]: *** [mmx_clr.o] Error 127 make[4]: Leaving directory `/home/me/Programs/fpc/fpsrc/2.5.1/packages/hermes' make[3]: *** [fpc_smart] Error 2 make[3]: Leaving directory `/home/me/Programs/fpc/fpsrc/2.5.1/packages/hermes' make[2]: *** [hermes_smart] Error 2 make[2]: Leaving directory `/home/me/Programs/fpc/fpsrc/2.5.1/packages' make[1]: *** [packages_smart] Error 2 make[1]: Leaving directory `/home/me/Programs/fpc/fpsrc/2.5.1' make: *** [build-stamp.i386-win32] Error 2 What should I do to build the 2.5.1 crosscompiler successully? ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Widestring Questions
2010/10/26 Tobias Giesen tobias_subscri...@tgtools.com: I think the problem might be that Widestring reference counting is not thread safe. But it worked fine in FPC 2.2. A bug may show anytime anywhere, but the built in ref counted string types are AFAIK thread safe what concerns the ref count per se. I suspect a subtle flaw in the client code is more probable. -- bflm freepascal-bits.blogspot.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal