www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7271] New: Calling struct.init causes a memory allocation.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7271

           Summary: Calling struct.init causes a memory allocation.
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: code benjamin-thaut.de



PST ---
struct MemoryBlockInfo
{
  size_t size;
  long[10] backtrace;
  int backtraceSize;

  this(size_t size)
  {
    this.size = size;
  }
}

int main(string[] argv)
{
  MemoryBlockInfo info;
  info = MemoryBlockInfo.init; //array allocation here
} 

This allocation seems totaly unneccesary. Also TypeInfo.init should return a
immutable(void)[] instead of a void[] as it seems totaly illogical to modify
the data retreived by TypeInfo.init.

This is especially critical when working without a GC because one is not able
to free the allocated memory for the array as the allocation gets generated by
the compiler.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 11 2012
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7271


Brad Anderson <eco gnuk.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |eco gnuk.net



Discussion suggesting this is resolved and should be closed.

http://forum.dlang.org/post/jsmipc$17h7$1 digitalmars.com

I couldn't find the issue it was a duplicate of.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 04 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7271


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bearophile_hugs eml.cc
         Resolution|                            |FIXED




 Discussion suggesting this is resolved and should be closed.
Now it's closed as fixed.
 I couldn't find the issue it was a duplicate of.
Maybe it was fixed fixing Issue 7243 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jul 04 2012