[PATCH] vbo: plug a leak

View: New views
2 Messages — Rating Filter:   Alert me  

[PATCH] vbo: plug a leak

by Ralovich, Kristóf :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

This patch plugs a leak triggerable by display lists. I am not
familiar with this part of mesa, maybe there are better ways to do
this, in that case regard the patch as a pointer to the problem.

Tested and works with sauerbraten and gears.

Please review!

Thanks,
Kristof

>From 5567e4ea594d95bd76b4df9feb408b49a466d378 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?RALOVICH,=20Krist=C3=B3f?= <tade60@...>
Date: Wed, 1 Jul 2009 19:35:39 +0200
Subject: [PATCH 4/8] vbo: plug a leak

---
 src/mesa/vbo/vbo_save_api.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 3c4c8ac..d0f4949 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -380,6 +380,11 @@ static void _save_compile_vertex_list( GLcontext *ctx )
    /* Reset our structures for the next run of vertices:
     */
    _save_reset_counters( ctx );
+
+   if (node->current_data) {
+     FREE(node->current_data);
+     node->current_data=0;
+   }
 }


--
1.6.3.3

[0004-vbo-plug-a-leak.patch]

From 5567e4ea594d95bd76b4df9feb408b49a466d378 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?RALOVICH,=20Krist=C3=B3f?= <tade60@...>
Date: Wed, 1 Jul 2009 19:35:39 +0200
Subject: [PATCH 4/8] vbo: plug a leak

---
 src/mesa/vbo/vbo_save_api.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index 3c4c8ac..d0f4949 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -380,6 +380,11 @@ static void _save_compile_vertex_list( GLcontext *ctx )
    /* Reset our structures for the next run of vertices:
     */
    _save_reset_counters( ctx );
+
+   if (node->current_data) {
+     FREE(node->current_data);
+     node->current_data=0;
+   }
 }
 
 
--
1.6.3.3



------------------------------------------------------------------------------

_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@...
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev

Re: [PATCH] vbo: plug a leak

by Brian Paul-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

RALOVICH wrote:
> This patch plugs a leak triggerable by display lists. I am not
> familiar with this part of mesa, maybe there are better ways to do
> this, in that case regard the patch as a pointer to the problem.
>
> Tested and works with sauerbraten and gears.
>
> Please review!

Here's my fix for the leak.  We want to free the node's current data
when the node is destroyed, not during display list construction.

Please test with your app(s) and let me know.

-Brian

diff --git a/src/mesa/vbo/vbo_save_api.c b/src/mesa/vbo/vbo_save_api.c
index f8e46ff..d00d304 100644
--- a/src/mesa/vbo/vbo_save_api.c
+++ b/src/mesa/vbo/vbo_save_api.c
@@ -1144,6 +1144,11 @@ static void vbo_destroy_vertex_list( GLcontext *ctx, void *data )
 
    if ( --node->prim_store->refcount == 0 )
       FREE( node->prim_store );
+
+   if (node->current_data) {
+      FREE(node->current_data);
+      node->current_data = NULL;
+   }
 }
 
 

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Mesa3d-dev mailing list
Mesa3d-dev@...
https://lists.sourceforge.net/lists/listinfo/mesa3d-dev