[Mesa-dev] [PATCH] i965: fix disk_cache leak when destroying context

Tapani Pälli tapani.palli at intel.com
Mon Jan 29 06:07:24 UTC 2018



On 01/27/2018 01:29 AM, Jordan Justen wrote:
> On 2018-01-26 00:48:42, Tapani Pälli wrote:
>>     ==2780== 1,024 bytes in 1 blocks are possibly lost in loss record 180 of 205
>>     ==2780==    at 0x4C31A1E: calloc (vg_replace_malloc.c:711)
>>     ==2780==    by 0x13F6467E: util_queue_init (u_queue.c:309)
>>     ==2780==    by 0x13F5C9F6: disk_cache_create (disk_cache.c:369)
>>     ==2780==    by 0x13F05406: brw_disk_cache_init (brw_disk_cache.c:428)
>>     ==2780==    by 0x13F01E78: brwCreateContext (brw_context.c:1068)
>>
>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>> ---
>>   src/mesa/drivers/dri/i965/brw_context.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
>> index 9ed8bc64bb..07a234b367 100644
>> --- a/src/mesa/drivers/dri/i965/brw_context.c
>> +++ b/src/mesa/drivers/dri/i965/brw_context.c
>> @@ -73,6 +73,7 @@
>>   #include "tnl/t_pipeline.h"
>>   #include "util/ralloc.h"
>>   #include "util/debug.h"
>> +#include "util/disk_cache.h"
>>   #include "isl/isl.h"
>>   
>>   /***************************************
>> @@ -1129,6 +1130,8 @@ intelDestroyContext(__DRIcontext * driContextPriv)
> 
> I guess this would move to intelDestroyScreen when you pick up Emil's
> suggestion to move the cache to the screen rather than context.

Yes, this is the plan. I found out these when investigating possible 
leaks introduced with the move.

> Reviewed-by: Jordan Justen <jordan.l.justen at intel.com>
> 
>>   
>>      driDestroyOptionCache(&brw->optionCache);
>>   
>> +   disk_cache_destroy(brw->ctx.Cache);
>> +
>>      /* free the Mesa context */
>>      _mesa_free_context_data(&brw->ctx);
>>   
>> -- 
>> 2.14.3
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list