[Mesa-dev] [PATCH 08/11] i965: Switch fs_inst to the non-zeroing allocator.

Francisco Jerez currojerez at riseup.net
Fri Sep 20 21:51:46 PDT 2013


All member variables of fs_inst are already being initialized from its
constructor, it's not necessary to use rzalloc to allocate its memory,
and doing so makes it more likely that we will start relying on the
allocator to zero out all memory if the class is ever extended with
new member variables.

That's bad because it ties objects to some specific allocation scheme,
and gives unpredictable results when an object is created with a
different allocator -- Stack allocation, array allocation, or
aggregation inside a different object are some of the useful
possibilities that come to my mind.
---
 src/mesa/drivers/dri/i965/brw_fs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.h b/src/mesa/drivers/dri/i965/brw_fs.h
index 8d35112..6d93132 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.h
+++ b/src/mesa/drivers/dri/i965/brw_fs.h
@@ -124,7 +124,7 @@ public:
 
 class fs_inst : public backend_instruction {
 public:
-   DECLARE_RZALLOC_CXX_OPERATORS(fs_inst)
+   DECLARE_RALLOC_CXX_OPERATORS(fs_inst)
 
    void init();
 
-- 
1.8.3.4



More information about the mesa-dev mailing list