From 592e7ce06c9cfb84bbc003adf2142d63c0528dba Mon Sep 17 00:00:00 2001
From: Rye Mutt <rye@alchemyviewer.org>
Date: Wed, 30 Dec 2020 12:33:23 -0500
Subject: [PATCH] Optimize two vectors in alpha draw pool by making them static
 and clearing at end of draw, this avoids thousands of mallocs

---
 indra/newview/lldrawpoolalpha.cpp | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp
index 36153916108..f4e0d210c5c 100644
--- a/indra/newview/lldrawpoolalpha.cpp
+++ b/indra/newview/lldrawpoolalpha.cpp
@@ -628,8 +628,8 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
 		if (group->getSpatialPartition()->mRenderByGroup &&
 		    !group->isDead())
 		{
-            std::vector<LLDrawInfo*> emissives;
-            std::vector<LLDrawInfo*> fullbrights;
+            static std::vector<LLDrawInfo*> emissives;
+            static std::vector<LLDrawInfo*> fullbrights;
 
 			bool is_particle_or_hud_particle = group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_PARTICLE
 													  || group->getSpatialPartition()->mPartitionType == LLViewerRegion::PARTITION_HUD_PARTICLE;
@@ -849,6 +849,9 @@ void LLDrawPoolAlpha::renderAlpha(U32 mask, S32 pass)
             {
                 current_shader->bind();
             }
+
+			emissives.clear();
+			fullbrights.clear();
 		}        
 	}
 
-- 
GitLab