http://d.puremagic.com/issues/show_bug.cgi?id=1382


Don <clugd...@yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugd...@yahoo.com.au




--- Comment #4 from Don <clugd...@yahoo.com.au>  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[10000];

  for(int i = 0; i < n; ++i) {
    result[0]= i;
  }
  return 0;
}

const int bad = junk(100000);
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: -------

Reply via email to