[Issue 4487] 16 bytes long structs requires 32 bytes if allocated singularly on the heap

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 19 13:10:52 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4487


Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com
          Component|druntime                    |DMD
         AssignedTo|sean at invisibleduck.org      |nobody at puremagic.com
           Severity|major                       |enhancement


--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> 2010-07-19 13:10:48 PDT ---
DMD is the main culprit here, not druntime.  And this is not a bug, it's an
enhancement.  DMD functions exactly as designed.

DMD is the one generating the code to call the arrayNew function with length 1.
 Druntime cannot tell between someone actually allocating an array of 1 or
someone allocating a single struct.

With the "Appendable" bit I just added for druntime, this could be alleviated
if the compiler would call a separate function for struct allocators.

As a workaround, you can pre-allocate a large block of nodes, which will only
have one byte of pad per block allocated.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list