Issue 24882 - COM class is allocated using GC not malloc
Summary: COM class is allocated using GC not malloc
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All Windows
: P1 regression
Assignee: No Owner
URL:
Keywords: pull
Depends on:
Blocks:
 
Reported: 2024-11-26 01:58 UTC by Richard (Rikki) Andrew Cattermole
Modified: 2024-11-29 13:18 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Richard (Rikki) Andrew Cattermole 2024-11-26 01:58:43 UTC
When ``_d_newclassT`` was templified, the COM support was regressed.

Previously it would allocate using malloc, now it allocates using the GC.

https://github.com/dlang/dmd/blob/f1adbd18a2fe262ee7474193383ea579f09e794e/druntime/src/core/lifetime.d#L2742

The reason for this regression is the gate for determining if a class is a COM class. Previously it used the TypeInfo flag.

https://github.com/dlang/dmd/blob/1317ba12e242c1fffa76d1cb5e1a405745f89021/druntime/src/rt/lifetime.d#L92

COM classes have the linkage D, but are actually C++ classes in ABI. Due to this they cannot be checked by the linkage, and changing this would either result in a lie, or not be a useful distinction here.

My suggestion is to add a new trait ``isCOMClass``, it needs to read the field ``com`` and return that from the class declaration.
Comment 1 Dlang Bot 2024-11-26 04:10:55 UTC
@rikkimax created dlang/dmd pull request #17095 "Fix bugzilla issue 24882 - COM class is allocated using GC not malloc" fixing this issue:

- Fix bugzilla issue 24882 - COM class is allocated using GC not malloc

https://github.com/dlang/dmd/pull/17095
Comment 2 Dlang Bot 2024-11-29 07:37:14 UTC
dlang/dmd pull request #17095 "Fix bugzilla issue 24882 - COM class is allocated using GC not malloc" was merged into stable:

- cc21a03174dc2fb627442ca201a1f0ed9d18a9bc by Richard (Rikki) Andrew Cattermole:
  Fix bugzilla issue 24882 - COM class is allocated using GC not malloc

https://github.com/dlang/dmd/pull/17095
Comment 3 Dlang Bot 2024-11-29 13:18:45 UTC
dlang/dmd pull request #17098 "Merge stable" was merged into master:

- 6567f6f4a4a6ad95da1a340e12b1f1130a5a10c0 by Richard (Rikki) Andrew Cattermole:
  Fix bugzilla issue 24882 - COM class is allocated using GC not malloc

https://github.com/dlang/dmd/pull/17098