Documentation bugs

Jari-Matti Mäkelä jmjmak at utu.fi.invalid
Thu Mar 9 14:33:08 PST 2006


Thomas Kuehne wrote:
> Jari-Matti Mýkelý schrieb am 2006-03-08:
> 
> [snip]
> 
>>> 4. One other question - what are the hard limits of DMD? For example,
>>> how many objects of a class can be instantiated at most? We have made a
>>> suffix tree -algorithm that generates a huge amount of objects. I think
>>> the compiler introduces some limits, since the algorithm segfaults only
>>> after about >300 identical successful runs - the amount of successful
>>> identical runs before segfault decreases when the tree depth increases.
>>> It segfaults on the following code:
>>>
>>> class Node {
>>>   Node[char] children;
>>>   char[] label;
>>>
>>>   void fn(char[] s) {
>>>     assert(s !is null);
>>>     assert(s.length > 0);
>>>     assert(s[0] in children);
>>>     auto a = children[s[0]];
>>>     assert(a !is null);
>>>     char[] l = a.label;  // segfault exactly here
>>>     assert(l != null);
>>>     ...
>>>   }
>>> }
>>>
>>> The segfault shouldn't be possible since all objects all guaranteed to
>>> be properly allocated from the heap. We don't use any explicit memory
>>> management. I can post the whole source if needs be.
> 
> Are you sure you aren't hitting the memory limit of your system?

No, I think I'm not. The program is consuming < 50 MB of memory and I
have > 2 GB of physical RAM + swap. It takes a while to fill all memory
(especially the swap partition), but this algorithm segfaults already in
1-2 seconds. I have another D program that is trying to fill up the
memory as fast as possible with small linked lists. It's only able to
occupy ~300 MB in 2 seconds.

I'm not sure, but I think the problem is in the slicing code (most
probably), in associative arrays or in the code that creates new
instances of classes. I'm working on a minimal test case. It's ~200 LOC now.

-- 
Jari-Matti



More information about the Digitalmars-d-bugs mailing list