<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I believe that as long as the CALLOC_STRUCT continue to get paired with right FREE call (or equivalent if these get renamed) either way should work for us.  Whatever option proposed gets followed, there's a risk these can get out of balanced, but the risk seems
 comparable.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
For context, IIRC, the main reason these macros remain useful for VMware is the sad state of memory debugging tools on Windows.  AFAICT, best hope of one day deprecating this would be use AddressSanitizer, which is supported on MSVC [1], but unfortunately not
 yet on MinGW w/ GCC [2], and we rely upon a lot for day-to-day development, using Linux cross-compilation.  Using MinGW w/ Clang cross compiler seems be a way to overcome this difficulty, but that too was still in somewhat experimental state when I last tried
 it.</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jose</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
[1] <a href="https://devblogs.microsoft.com/cppblog/asan-for-windows-x64-and-debug-build-support/">https://devblogs.microsoft.com/cppblog/asan-for-windows-x64-and-debug-build-support/</a></div>
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
[2] <a href="https://stackoverflow.com/questions/67619314/cannot-use-fsanitize-address-in-mingw-compiler">https://stackoverflow.com/questions/67619314/cannot-use-fsanitize-address-in-mingw-compiler</a></div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Dave Airlie <airlied@gmail.com><br>
<b>Sent:</b> Wednesday, December 22, 2021 22:35<br>
<b>To:</b> mesa-dev <mesa-dev@lists.freedesktop.org>; Jose Fonseca <jfonseca@vmware.com>; Brian Paul <brianp@vmware.com><br>
<b>Subject:</b> revenge of CALLOC_STRUCT</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt">
<div class="PlainText">Hey,<br>
<br>
Happy holidays, and as though to consider over the break,<br>
<br>
We have the vmware used MALLOC/FREE/CALLOC/CALLOC_STRUCT wrappers used<br>
throughout gallium.<br>
<br>
We have ST_CALLOC_STRUCT in use in the mesa state tracker, not used in gallium.<br>
<br>
Merging the state tracker into mesa proper, and even prior to this a<br>
few CALLOC_STRUCT have started to leak into src/mesa/*.<br>
<br>
Now I don't think we want that, but CALLOC_STRUCT is a genuinely<br>
useful macro on it's own,<br>
I'm considering just defined a calloc_struct instead for the<br>
non-gallium use that goes with malloc/calloc/free.<br>
<br>
Any opinions, or should mesa just get u_memory.h support for Xmas?<br>
<br>
Dave.<br>
</div>
</span></font></div>
</body>
</html>