<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Sep 25, 2013, at 2:21 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: 'Lucida Grande'; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; ">I also know that regardless of the solution, Marshall has thoughts on the best way to factor this within the library, but those are orthogonal.</span></blockquote><br></div><div>Benjamin --</div><div><br></div><div>Here's my suggestion.</div><div><br></div><div>No matter how this comes out, I think having one place in the library where we allocate memory "in a default" manner is a good thing.</div><div>So let's do that first.</div><div><br></div><div>My suggestion is </div><div><br></div><div>1) Define two routines (probably in <new>):</div><div><br></div><div><div>_LIBCPP_ALWAYS_INLINE void *__allocate     ( std::size_t sz ) { return ::operator new ( sz ); }</div><div><div>_LIBCPP_ALWAYS_INLINE void *__deallocate ( void * p )         { return ::operator delete ( p ); }</div></div><div><br></div><div>[ MIght need different names, since hash_table has a __deallocate and dynarray has an __allocate and __deallocate ]</div><div><br></div></div><div>and call them from the places in <memory> that you noted.</div><div><br></div><div>2) Make sure that works, then switch them (__allocate/__deallocate) to use new char []/delete [] and make sure that your optimization still works.</div><div>Then, switch them back while we figure out the correct way to solve this.</div><div><br></div><div>3) Next, find all the places in libc++ where we call ::operator new/delete, and switch them over to calling __allocate/__deallocate.</div><div>That way, when we figure out the best way to solve this, we'll reap the benefits library-wide.</div><div><br></div><div>How does that sound to you?</div><div><br></div><div>-- Marshall</div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px; "><br>Marshall Clow     Idio Software   <<a href="mailto:mclow.lists@gmail.com">mailto:mclow.lists@gmail.com</a>><br><br>A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).<br>        -- Yu Suzuki</span>

</div>
<br></body></html>