Reported in the ML from Loïc Pefferkorn. In summary, 3.5 needs less than 30 MB of heap memory for defining 400K classes, while 3.6 needs more than 200MB. For details see "Loic's blog post":http://www.loicp.eu/blog/cfengine_how_many_classes_can_be_defined.
The offending code is in @ClassTablePut()@. Primarily setting tags with StringSetFromString(), and secondly the RBTreePut() function:
cls = xmalloc(sizeof(Class));
ClassInit(cls, ns, name, is_soft, scope);
// NULL tags are OK (but you want to give good tags, don't you?)
cls->tags = StringSetFromString(tags, ',');
return RBTreePut(table->classes, (void *)cls->hash, cls);