Thread overview
out of memory error with template mixins
Dec 03, 2009
Saaa
Dec 03, 2009
Saaa
Dec 03, 2009
bearophile
Dec 03, 2009
Saaa
Dec 03, 2009
Saaa
Dec 04, 2009
Saaa
Dec 04, 2009
Saaa
December 03, 2009
I was trying out composite oriented programming, meaning moving class
functionality into templates which you then mixin.
First part mixined just fine, second also ok, third . .
- Error : Out of memory (2GB VM)
Even with an empty template :(




December 03, 2009
Removing a struct definition from the second mixin seems to fix the problem.
Is this a (known) bug?

The struct was only used within that template.

public struct S
{
enum LOCAL { ONE, TWO };
LOCAL local;
bool b = false;
StructOut s;
ENUM_OUT eo;
}



December 03, 2009
Saaa:
> Is this a (known) bug?

It's generally better if you show a tiny compilable example that has the problem.

Bye,
bearophile
December 03, 2009
bearophile wrote:
> Saaa:
>> Is this a (known) bug?
>
> It's generally better if you show a tiny compilable example that has the problem.
>
> Bye,
> bearophile

I'm trying :)
I just hoped somebody would recognize it from my babbling


December 03, 2009
Tomorrow I'll continue my quest for the mall piece of code which will choke the compiler.


December 04, 2009
Can't recreate the error in a small test project (5 modules).
I think the problem lies somewhere in between cyclic module imports, mixin
struct definitions and maybe the actual size of the class(1k) and its
complexity of interfaces(8).

One more thing:
The out of memory is before it can tell there is an variable missing,
although the error is also there when the variable is not missing.


December 04, 2009
module project.foo.templates.bar;

template Bar()
{
  //struct is not used anywhere
  public struct Eye{} //comment this line out and the error is gone.
}