[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
https://issues.dlang.org/show_bug.cgi?id=1382 --- Comment #16 from Walter Bright --- Some progress: https://github.com/dlang/dmd/pull/10343 --
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
https://issues.dlang.org/show_bug.cgi?id=1382 Andrei Alexandrescu changed: What|Removed |Added Version|D1 & D2 |D2 --
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
https://issues.dlang.org/show_bug.cgi?id=1382 ncras...@gmail.com changed: What|Removed |Added CC||ncras...@gmail.com --
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #15 from Don 2012-01-24 06:21:47 PST --- An important thing to realize about this bug is that it is *not* the primary cause of slow performance and high memory consumption in CTFE. Fixing this bug would make very little difference, except in cases involving concatenation. I think it's had a lot of votes because people think it's the key CTFE performance issue, but actually the bad guy is bug 6498. Which is easier to fix. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #14 from Leandro Lucarella 2012-01-24 02:37:46 PST --- (In reply to comment #13) > I tried it by building the library and running its unittests, and running the > test suite. It was considerably slower. > > The GC used was the old C++ version of the D runtime GC. > > You can build it by switching the GCOBJS macro in win32.mak. Oh, I was talking about the Bohem GC, the one tried by Christian Kamm, which is a pretty good state of the art collector AFAIK. I think LDC used it (I don't know if it still does) with pretty good results (see comment 3). Maybe Christian can give us some more information about it :) -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #13 from Walter Bright 2012-01-24 02:29:36 PST --- I tried it by building the library and running its unittests, and running the test suite. It was considerably slower. The GC used was the old C++ version of the D runtime GC. You can build it by switching the GCOBJS macro in win32.mak. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #12 from Leandro Lucarella 2012-01-24 02:19:04 PST --- (In reply to comment #11) > I made an experimental build of dmd that uses a gc. The compiler slowed down > quite a bit. In which cases did you tried it? For files that allocates a lot of "CTFE memory" it should be the other way around, as the memory consumption is so high that the system is using most of the time moving things around between the memory and the swap. Do you have a patch that I can try (for D1)? Thanks. As bad as it sounds, maybe a good tradeoff would be to add a command line option (as obscure an undocumented as you want) to activate the GC for cases where not using it is not really an option. Being that it seems that this bug is really hard, I think it might deserve looking for a workaround to be able to use the compiler in this extreme cases in the short term. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #11 from Walter Bright 2012-01-23 11:23:06 PST --- I made an experimental build of dmd that uses a gc. The compiler slowed down quite a bit. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 Leandro Lucarella changed: What|Removed |Added CC||leandro.lucarella@sociomant ||ic.com --- Comment #10 from Leandro Lucarella 2012-01-23 02:41:48 PST --- Is there any technical reason not to use the Bohem GC as a temporary workaround until this can get properly fixed? I'm just curious. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 Don changed: What|Removed |Added Target Milestone|2.059 |--- --- Comment #9 from Don 2012-01-21 01:26:54 PST --- Please don't set milestones without consultation (unless you plan to fix the bug yourself). This bug is still open because it is HARD. I've been slowly making progress on it for the last year. It's not going to be fixed soon -- the remaining work to be done is still about the equivalent of 30 avarage bugs. However, 90% of the symptoms were fixed in 2.049. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 Jesse Phillips changed: What|Removed |Added CC||jesse.k.phillip...@gmail.co ||m Target Milestone|--- |2.059 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #8 from Don 2011-09-02 00:21:14 PDT --- (In reply to comment #7) > It appears that _any_ access of an array variable allocates ram, resulting in > drastically slower compile times (+55 seconds) and excess memory usage (30+ mb > in this case using DMD 2.050) This was fixed in 2.054. There were several cases where reading or writing a single array element could cause the entire array to be copied! These cases have now been fixed, giving an order of magnitude improvement in memory use and compilation time. (The original test case (concatenation) hasn't changed; it's simply caused by absence of a compile-time gc). This bug is now a far less serious problem than bug 6498. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 Rob Jacques changed: What|Removed |Added CC||sandf...@jhu.edu --- Comment #7 from Rob Jacques 2010-12-06 12:09:04 PST --- I just came across this bug while working on improving std.variant: the combination of templates + ctfe + unittests resulted in out of memory errors. I've also traced down another issue (I don't know if it should be filed separately or not): It appears that _any_ access of an array variable allocates ram, resulting in drastically slower compile times (+55 seconds) and excess memory usage (30+ mb in this case using DMD 2.050) string ctfeTest() { char[] result; result.length = ushort.max; char c; for(size_t i = 0; i < result.length; i++) {} // Allocates for(size_t i = 0; i < ushort.max; i++) {}// Doesn't allocate for(size_t i = 0; i < ushort.max; i++) { // Allocates c = result[i]; } for(size_t i = 0; i < ushort.max; i++) { // Doesn't allocate c = cast(ubyte)('A' + i%26); } return cast(string)result; } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 bearophile_h...@eml.cc changed: What|Removed |Added CC||bearophile_h...@eml.cc --- Comment #6 from bearophile_h...@eml.cc 2010-06-04 15:19:11 PDT --- A partially artificial test case. Faster and better versions are quite possible, but I expect dmd to be able to run this quickly. import std.stdio: writeln; ubyte[1 << NPOW] setBits(int NPOW)() { nothrow pure uint setBits8(uint n) { uint result; foreach (i; 0 .. 8) if (n & (1 << i)) result++; return result; } nothrow pure uint setBits16(uint n) { enum uint FIRST_UBYTE = 0b___; enum uint SECOND_UBYTE = 0b___; return setBits8(n & FIRST_UBYTE) + setBits8((n & SECOND_UBYTE) >> 8); } typeof(return) result; foreach (i; 1 .. result.length) result[i] = cast(typeof(result[0]))setBits16(i); return result; } enum nbits = setBits!16(); // currently 12 is about the max void main() { writeln(nbits); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 Don changed: What|Removed |Added Severity|blocker |critical --- Comment #5 from Don 2009-08-31 23:59:27 PDT --- Reducing severity back to critical, since the voting system takes care of the importance. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 Don changed: What|Removed |Added CC||clugd...@yahoo.com.au --- Comment #4 from Don 2009-08-03 05:18:25 PDT --- I don't think Boehm gc is the answer. Note that this is very closely related to bug#1330. I think the CTFE implementation of arrays needs (a) reference semantics and (b) reference counting. Here's an example of a terrible case, which allocates several Gb of RAM: int junk(int n) { int[] result = new int[1]; for(int i = 0; i < n; ++i) { result[0]= i; } return 0; } const int bad = junk(10); void main() {} This particular case could be solved by adding a reference-based system for storing array values, instead of doing copy-on-write -- and that's required for bug #1330 anyway. Once that's in place, the array values could be allocated in a controlled manner (eg, retain a list of all allocated CTFE arrays). A dedicated precise GC can then be simple and fast, since it only needs to check for array references in the current function, and they can only be in the local variables which are arrays or structs. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 1382] memory allocated for arrays in CTFE functions during compilation is not released
http://d.puremagic.com/issues/show_bug.cgi?id=1382 --- Comment #3 from [EMAIL PROTECTED] 2008-12-02 12:31 --- We've had some success with reenabling boehm-gc: http://www.dsource.org/projects/ldc/ticket/49 . "Another test with USE_BOEHM_GC=0, REDIRECT_MALLOC=GC_malloc and IGNORE_FREE seemed to yield good results, with no segfaults and collecting CTFE memory properly." --