digitalmars.D.bugs - Program hangs on Windows - DMD 0.99
- Dave (39/39) Aug 20 2004 Windows 2003 Server
- pragma (8/47) Aug 20 2004 I just tested this on my machine (WindowsXP-SP1) and got the same result...
- Walter (6/45) Aug 20 2004 It's apparently thrashing itself to death. Try using OutBuffer.reserve()...
- Dave (33/96) Aug 21 2004 It's not necessarily the performance I'm concerned about, but that was j...
Windows 2003 Server DMD 0.99 (also 0.98) The following program will hang on return from main when it is run with an argument of >= 8388607. An argument of <= 8388606 will /not/ 'hang'. This is consistent and repeatable on this platform. The program does not hang like this using DMD for Linux. The program does still hang when the Timer() and printf(...)'s are removed. On Windows at least, the concatenation also takes ~50% longer to complete the concatenation when the iterations move from 8388606 to 8388607. ;--- import timer; import std.string; import std.outbuffer; int main(char[][] args) { int n = args.length < 2 ? 1 : std.string.atoi(args[1]); Timer t = new Timer(); OutBuffer ob = new OutBuffer(); for (int i = 0; i < n; i++) ob.write("hello\n"); printf("%d\n", ob.toString().length); printf("%.*s\n",t.Elapsed()); return(0); } ;--- import std.date; import std.string; import std.outbuffer; class Timer { this() { tvs = getUTCtime(); } char[] Elapsed() { tve = getUTCtime(); OutBuffer ob = new OutBuffer; ob.printf(" %2.6f seconds",(tve - tvs) / cast(double)TicksPerSecond); return(ob.toString()); } private: d_time tvs, tve; }
Aug 20 2004
I just tested this on my machine (WindowsXP-SP1) and got the same results. For grins, I opened Task Manager and enabled all the columns to see what was going on. At the point where it 'hangs', the memory useage was counting upwards at phenomenal rate along with the page faults. With my Task Manager set on "high" as its refresh rate, i was seeing a difference of 200Kb of memory and 70-odd faults per update. - Pragma In article <cg4vmc$bj1$1 digitaldaemon.com>, Dave says...Windows 2003 Server DMD 0.99 (also 0.98) The following program will hang on return from main when it is run with an argument of >= 8388607. An argument of <= 8388606 will /not/ 'hang'. This is consistent and repeatable on this platform. The program does not hang like this using DMD for Linux. The program does still hang when the Timer() and printf(...)'s are removed. On Windows at least, the concatenation also takes ~50% longer to complete the concatenation when the iterations move from 8388606 to 8388607. ;--- import timer; import std.string; import std.outbuffer; int main(char[][] args) { int n = args.length < 2 ? 1 : std.string.atoi(args[1]); Timer t = new Timer(); OutBuffer ob = new OutBuffer(); for (int i = 0; i < n; i++) ob.write("hello\n"); printf("%d\n", ob.toString().length); printf("%.*s\n",t.Elapsed()); return(0); } ;--- import std.date; import std.string; import std.outbuffer; class Timer { this() { tvs = getUTCtime(); } char[] Elapsed() { tve = getUTCtime(); OutBuffer ob = new OutBuffer; ob.printf(" %2.6f seconds",(tve - tvs) / cast(double)TicksPerSecond); return(ob.toString()); } private: d_time tvs, tve; }
Aug 20 2004
It's apparently thrashing itself to death. Try using OutBuffer.reserve(). "Dave" <Dave_member pathlink.com> wrote in message news:cg4vmc$bj1$1 digitaldaemon.com...Windows 2003 Server DMD 0.99 (also 0.98) The following program will hang on return from main when it is run with an argument of >= 8388607. An argument of <= 8388606 will /not/ 'hang'. Thisisconsistent and repeatable on this platform. The program does not hang like this using DMD for Linux. The program doesstillhang when the Timer() and printf(...)'s are removed. On Windows at least, the concatenation also takes ~50% longer to completetheconcatenation when the iterations move from 8388606 to 8388607. ;--- import timer; import std.string; import std.outbuffer; int main(char[][] args) { int n = args.length < 2 ? 1 : std.string.atoi(args[1]); Timer t = new Timer(); OutBuffer ob = new OutBuffer(); for (int i = 0; i < n; i++) ob.write("hello\n"); printf("%d\n", ob.toString().length); printf("%.*s\n",t.Elapsed()); return(0); } ;--- import std.date; import std.string; import std.outbuffer; class Timer { this() { tvs = getUTCtime(); } char[] Elapsed() { tve = getUTCtime(); OutBuffer ob = new OutBuffer; ob.printf(" %2.6f seconds",(tve - tvs) / cast(double)TicksPerSecond); return(ob.toString()); } private: d_time tvs, tve; }
Aug 20 2004
It's not necessarily the performance I'm concerned about, but that was just one more symptom I noticed so I included that info. I realize the program is contrived and trivial, but I think it may point to a potential problem in the memory management system. As Pragma pointed out with his Task Manager info., there is definately something odd going on. If I put an explicit fullCollect() before the return and the buffer size grows beyond 50_331_636, the fullCollect() itself takes several minutes to return and Task Manager shows the same symptoms Pragma noted for the return from main in the original code. This and the arbitrary buffer size that causes the problem is really the 'bug' I was trying to point out. Also, if: ob.reserve(10); is added before the loop and the program is run for 10_000_000 iterations, the problem (and slower performance) goes away for some reason until the iterations grow to >= 10_400_000. If reserve is changed to: ob.reserve(100000); the same problem reappears for the same number of iterations (10_000_000). Given the seemingly arbitrary nature of this, I think there is a problem here. If a garbage collection causes this kind of hang under heavy use in the real world under some conditions, it would be a major problem I would think <g>. The 1/3 performance drop when the iterations move from 8388606 to 8388607 happens on Linux too. The difference is that fullCollect() doesn't hang on Linux. - Dave "Walter" <newshound digitalmars.com> wrote in message news:cg6gkr$158t$1 digitaldaemon.com...It's apparently thrashing itself to death. Try using OutBuffer.reserve(). "Dave" <Dave_member pathlink.com> wrote in message news:cg4vmc$bj1$1 digitaldaemon.com...anWindows 2003 Server DMD 0.99 (also 0.98) The following program will hang on return from main when it is run withThisargument of >= 8388607. An argument of <= 8388606 will /not/ 'hang'.isdoesconsistent and repeatable on this platform. The program does not hang like this using DMD for Linux. The programstillcompletehang when the Timer() and printf(...)'s are removed. On Windows at least, the concatenation also takes ~50% longer totheconcatenation when the iterations move from 8388606 to 8388607. ;--- import timer; import std.string; import std.outbuffer; int main(char[][] args) { int n = args.length < 2 ? 1 : std.string.atoi(args[1]); Timer t = new Timer(); OutBuffer ob = new OutBuffer(); for (int i = 0; i < n; i++) ob.write("hello\n"); printf("%d\n", ob.toString().length); printf("%.*s\n",t.Elapsed()); return(0); } ;--- import std.date; import std.string; import std.outbuffer; class Timer { this() { tvs = getUTCtime(); } char[] Elapsed() { tve = getUTCtime(); OutBuffer ob = new OutBuffer; ob.printf(" %2.6f seconds",(tve - tvs) / cast(double)TicksPerSecond); return(ob.toString()); } private: d_time tvs, tve; }
Aug 21 2004