Profile mode maintenance patch
François Dumont
frs.dumont@gmail.com
Tue Sep 23 21:20:00 GMT 2014
On 23/09/2014 13:27, Jonathan Wakely wrote:
> On 21/09/14 23:29 +0200, François Dumont wrote:
>> With all those modifications I have been able to run all testsuite
>> in profile mode with success.
>
> I've looked over the patch and it looks fine.
>
> I don't know the details of the Profile Mode, so if you're happy that
> these changes are an improvement and all tests pass then that's good
> enough for me.
>
>> Ok to commit ?
>
> Yes, OK for trunk - thanks very much.
>
>
Ok but could you just let me know what you think of this method:
template<typename __object_info, typename __stack_info>
__object_info*
__trace_base<__object_info, __stack_info>::
__add_object(const __object_info& __info)
{
if (__max_mem() != 0 && __objects_byte_size >= __max_mem())
{
delete __info.__stack();
return 0;
}
__object_info* __ret = new(std::nothrow) __object_info(__info);
if (!__ret)
{
delete __info.__stack();
return 0;
}
__gnu_cxx::__atomic_add(&__objects_byte_size, sizeof(__object_info));
return __ret;
}
This method can be called from several threads. I check condition
accessing __object_byte_size and then update it with an atomic operation
to make sure it stays consistent. Does it look ok to you too ?
François
More information about the Libstdc++
mailing list