D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13951 - Massive amounts of bloat generated for asserts by template.c
Summary: Massive amounts of bloat generated for asserts by template.c
Status: RESOLVED REMIND
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-08 04:09 UTC by Walter Bright
Modified: 2022-12-16 14:02 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Walter Bright 2015-01-08 04:09:00 UTC
The dmd source code in template.c:
-------------------------------------------------------
void TemplateDeclaration::semantic(Scope *sc)
{
    [...]
    if (Module *m = sc->module) // should use getModule() instead?
    {
        // Generate these functions as they may be used
        // when template is instantiated in other modules
        // even if assertions or bounds checking are disabled in this module
        m->toModuleArray();
        m->toModuleAssert();     <=============
        m->toModuleUnittest();
    }
---------------------------------------------------

This results in huge numbers of assert() functions to be generated, each with its own copy of the source file name string. The assert() function is generated as a COMDAT, which removes duplicates, but the filename strings are not put in COMDATs and are duplicated innumerable times.
Comment 1 Vladimir Panteleev 2017-07-21 10:49:59 UTC
(In reply to Walter Bright from comment #0)
> The dmd source code in template.c:

I see that this code block has been removed in https://github.com/dlang/dmd/pull/4858/files#diff-0477a1d81a6a920c99362954179c59c8L5915 .

Is this still an issue? Is there a simple way to reproduce the problem?