memcpy(new_backing, old_backing, sizeof(uintptr_t) * capacity_);
monitor_chunks_.StoreRelaxed(new_backing);
capacity_ = new_capacity;
- old_chunk_arrays_.push_back(old_backing);
+ old_chunk_arrays_.push_back(std::unique_ptr<uintptr_t[]>(old_backing));
VLOG(monitor) << "Resizing to capacity " << capacity_;
}
}
size_t capacity_ GUARDED_BY(Locks::allocated_monitor_ids_lock_);
// To avoid race issues when resizing, we keep all the previous arrays.
- std::vector<uintptr_t*> old_chunk_arrays_ GUARDED_BY(Locks::allocated_monitor_ids_lock_);
+ std::vector<std::unique_ptr<uintptr_t[]>> old_chunk_arrays_
+ GUARDED_BY(Locks::allocated_monitor_ids_lock_);
typedef TrackingAllocator<uint8_t, kAllocatorTagMonitorPool> Allocator;
Allocator allocator_;
}
static void testConversions(uint16_t *buf, int char_count) {
- char bytes_test[8], bytes_reference[8];
- uint16_t out_buf_test[4], out_buf_reference[4];
+ char bytes_test[8] = { 0 }, bytes_reference[8] = { 0 };
+ uint16_t out_buf_test[4] = { 0 }, out_buf_reference[4] = { 0 };
int byte_count_test, byte_count_reference;
int char_count_test, char_count_reference;
TEST_F(UtfTest, ExhaustiveBidirectionalCodePointCheck) {
for (int codePoint = 0; codePoint <= 0x10ffff; ++codePoint) {
- uint16_t buf[4];
+ uint16_t buf[4] = { 0 };
if (codePoint <= 0xffff) {
if (codePoint >= 0xd800 && codePoint <= 0xdfff) {
// According to the Unicode standard, no character will ever