MySQL 8.0.39
Source Code Documentation
prealloced_array.h
Go to the documentation of this file.
1/* Copyright (c) 2013, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef PREALLOCED_ARRAY_INCLUDED
25#define PREALLOCED_ARRAY_INCLUDED
26
27/**
28 @file include/prealloced_array.h
29*/
30
31#include <assert.h>
32#include <stddef.h>
33#include <algorithm>
34#include <new>
35#include <type_traits>
36#include <utility>
37
38#include "my_compiler.h"
39
40#include "my_inttypes.h"
41#include "my_sys.h"
44
45/**
46 A typesafe replacement for DYNAMIC_ARRAY. We do our own memory management,
47 and pre-allocate space for a number of elements. The purpose is to
48 pre-allocate enough elements to cover normal use cases, thus saving
49 malloc()/free() overhead.
50 If we run out of space, we use malloc to allocate more space.
51
52 The interface is chosen to be similar to std::vector.
53 We keep the std::vector property that storage is contiguous.
54
55 We have fairly low overhead over the inline storage; typically 8 bytes
56 (e.g. Prealloced_array<TABLE *, 4> needs 40 bytes on 64-bit platforms).
57
58 @remark
59 Unlike DYNAMIC_ARRAY, elements are properly copied
60 (rather than memcpy()d) if the underlying array needs to be expanded.
61
62 @remark
63 Depending on Has_trivial_destructor, we destroy objects which are
64 removed from the array (including when the array object itself is destroyed).
65
66 @tparam Element_type The type of the elements of the container.
67 Elements must be copyable or movable.
68 @tparam Prealloc Number of elements to pre-allocate.
69 */
70template <typename Element_type, size_t Prealloc>
72 /**
73 Is Element_type trivially destructible? If it is, we don't destroy
74 elements when they are removed from the array or when the array is
75 destroyed.
76 */
77 static constexpr bool Has_trivial_destructor =
78 std::is_trivially_destructible<Element_type>::value;
79
80 bool using_inline_buffer() const { return m_inline_size >= 0; }
81
82 /**
83 Gets the buffer in use.
84 */
85 Element_type *buffer() {
87 }
88 const Element_type *buffer() const {
90 }
91
92 void set_size(size_t n) {
93 if (using_inline_buffer()) {
95 } else {
97 }
98 }
99 void adjust_size(int delta) {
100 if (using_inline_buffer()) {
101 m_inline_size += delta;
102 } else {
103 m_ext.m_alloced_size += delta;
104 }
105 }
106
107 public:
108 /// Initial capacity of the array.
109 static const size_t initial_capacity = Prealloc;
110
111 /// Standard typedefs.
112 typedef Element_type value_type;
113 typedef size_t size_type;
114 typedef ptrdiff_t difference_type;
115
116 typedef Element_type *iterator;
117 typedef const Element_type *const_iterator;
118
119 explicit Prealloced_array(PSI_memory_key psi_key) : m_psi_key(psi_key) {
120 static_assert(Prealloc != 0, "We do not want a zero-size array.");
121 }
122
123 /**
124 Initializes (parts of) the array with default values.
125 Using 'Prealloc' for initial_size makes this similar to a raw C array.
126 */
127 Prealloced_array(PSI_memory_key psi_key, size_t initial_size)
128 : m_psi_key(psi_key) {
129 static_assert(Prealloc != 0, "We do not want a zero-size array.");
130
131 if (initial_size > Prealloc) {
132 // We avoid using reserve() since it requires Element_type to be copyable.
133 void *mem =
134 my_malloc(m_psi_key, initial_size * element_size(), MYF(MY_WME));
135 if (!mem) return;
136 m_inline_size = -1;
137 m_ext.m_alloced_size = initial_size;
138 m_ext.m_array_ptr = static_cast<Element_type *>(mem);
139 m_ext.m_alloced_capacity = initial_size;
140 } else {
141 m_inline_size = initial_size;
142 }
143 for (size_t ix = 0; ix < initial_size; ++ix) {
144 Element_type *p = &buffer()[ix];
145 ::new (p) Element_type();
146 }
147 }
148
149 /**
150 An object instance "owns" its array, so we do deep copy here.
151 */
153 if (this->reserve(that.capacity())) return;
154 for (const Element_type *p = that.begin(); p != that.end(); ++p)
155 this->push_back(*p);
156 }
157
159 *this = std::move(that);
160 }
161
162 /**
163 Range constructor.
164
165 Constructs a container with as many elements as the range [first,last),
166 with each element constructed from its corresponding element in that range,
167 in the same order.
168 */
171 : m_psi_key(psi_key) {
172 if (this->reserve(last - first)) return;
173 for (; first != last; ++first) push_back(*first);
174 }
175
176 Prealloced_array(std::initializer_list<Element_type> elems)
177 : Prealloced_array(PSI_NOT_INSTRUMENTED, elems.begin(), elems.end()) {}
178
179 /**
180 Copies all the elements from 'that' into this container.
181 Any objects in this container are destroyed first.
182 */
184 this->clear();
185 if (this->reserve(that.capacity())) return *this;
186 for (const Element_type *p = that.begin(); p != that.end(); ++p)
187 this->push_back(*p);
188 return *this;
189 }
190
192 this->clear();
193 if (!that.using_inline_buffer()) {
195 // The array is on the heap, so we can just grab it.
196 m_ext.m_array_ptr = that.m_ext.m_array_ptr;
197 m_inline_size = -1;
198 m_ext.m_alloced_size = that.m_ext.m_alloced_size;
199 m_ext.m_alloced_capacity = that.m_ext.m_alloced_capacity;
200 that.m_inline_size = 0;
201 } else {
202 // Move over each element.
203 if (this->reserve(that.capacity())) return *this;
204 for (Element_type *p = that.begin(); p != that.end(); ++p)
205 this->push_back(std::move(*p));
206 that.clear();
207 }
208 return *this;
209 }
210
211 /**
212 Runs DTOR on all elements if needed.
213 Deallocates array if we exceeded the Preallocated amount.
214 */
217 clear();
218 }
220 }
221
222 size_t capacity() const {
223 return using_inline_buffer() ? Prealloc : m_ext.m_alloced_capacity;
224 }
225 size_t element_size() const { return sizeof(Element_type); }
226 bool empty() const { return size() == 0; }
227 size_t size() const {
229 }
230
231 Element_type &at(size_t n) {
232 assert(n < size());
233 return buffer()[n];
234 }
235
236 const Element_type &at(size_t n) const {
237 assert(n < size());
238 return buffer()[n];
239 }
240
241 Element_type &operator[](size_t n) { return at(n); }
242 const Element_type &operator[](size_t n) const { return at(n); }
243
244 Element_type &back() { return at(size() - 1); }
245 const Element_type &back() const { return at(size() - 1); }
246
247 Element_type &front() { return at(0); }
248 const Element_type &front() const { return at(0); }
249
250 /**
251 begin : Returns a pointer to the first element in the array.
252 end : Returns a pointer to the past-the-end element in the array.
253 */
254 iterator begin() { return buffer(); }
255 iterator end() { return buffer() + size(); }
256 const_iterator begin() const { return buffer(); }
257 const_iterator end() const { return buffer() + size(); }
258 /// Returns a constant pointer to the first element in the array.
259 const_iterator cbegin() const { return begin(); }
260 /// Returns a constant pointer to the past-the-end element in the array.
261 const_iterator cend() const { return end(); }
262
263 /**
264 Assigns a value to an arbitrary element, even where n >= size().
265 The array is extended with default values if necessary.
266 @retval true if out-of-memory, false otherwise.
267 */
268 bool assign_at(size_t n, const value_type &val) {
269 if (n < size()) {
270 at(n) = val;
271 return false;
272 }
273 if (reserve(n + 1)) return true;
274 resize(n);
275 return push_back(val);
276 }
277
278 /**
279 Reserves space for array elements.
280 Copies (or moves, if possible) over existing elements, in case we
281 are re-expanding the array.
282
283 @param n number of elements.
284 @retval true if out-of-memory, false otherwise.
285 */
286 bool reserve(size_t n) {
287 if (n <= capacity()) return false;
288
290 if (!mem) return true;
291 Element_type *new_array = static_cast<Element_type *>(mem);
292
293 // Move all the existing elements into the new array.
294 size_t old_size = size();
295 for (size_t ix = 0; ix < old_size; ++ix) {
296 Element_type *new_p = &new_array[ix];
297 Element_type &old_p = buffer()[ix];
298 ::new (new_p) Element_type(std::move(old_p)); // Move into new location.
300 old_p.~Element_type(); // Destroy the old element.
301 }
302
304
305 // Forget the old array;
306 m_ext.m_alloced_size = old_size;
307 m_inline_size = -1;
308 m_ext.m_array_ptr = new_array;
310 return false;
311 }
312
313 /**
314 Copies an element into the back of the array.
315 Complexity: Constant (amortized time, reallocation may happen).
316 @return true if out-of-memory, false otherwise
317 */
318 bool push_back(const Element_type &element) { return emplace_back(element); }
319
320 /**
321 Copies (or moves, if possible) an element into the back of the array.
322 Complexity: Constant (amortized time, reallocation may happen).
323 @return true if out-of-memory, false otherwise
324 */
325 bool push_back(Element_type &&element) {
326 return emplace_back(std::move(element));
327 }
328
329 /**
330 Constructs an element at the back of the array.
331 Complexity: Constant (amortized time, reallocation may happen).
332 @return true if out-of-memory, false otherwise
333 */
334 template <typename... Args>
335 bool emplace_back(Args &&... args) {
336 const size_t expansion_factor = 2;
337 if (size() == capacity() && reserve(capacity() * expansion_factor))
338 return true;
339 Element_type *p = &buffer()[size()];
340 adjust_size(1);
341 ::new (p) Element_type(std::forward<Args>(args)...);
342 return false;
343 }
344
345 /**
346 Removes the last element in the array, effectively reducing the
347 container size by one. This destroys the removed element.
348 */
349 void pop_back() {
350 assert(!empty());
351 if (!Has_trivial_destructor) back().~Element_type();
352 adjust_size(-1);
353 }
354
355 /**
356 The array is extended by inserting a new element before the element at the
357 specified position.
358
359 This is generally an inefficient operation, since we need to copy
360 elements to make a new "hole" in the array.
361
362 We use std::rotate to move objects, hence Element_type must be
363 move-assignable and move-constructible.
364
365 @return an iterator pointing to the inserted value
366 */
367 iterator insert(const_iterator position, const value_type &val) {
368 return emplace(position, val);
369 }
370
371 /**
372 The array is extended by inserting a new element before the element at the
373 specified position. The element is moved into the array, if possible.
374
375 This is generally an inefficient operation, since we need to copy
376 elements to make a new "hole" in the array.
377
378 We use std::rotate to move objects, hence Element_type must be
379 move-assignable and move-constructible.
380
381 @return an iterator pointing to the inserted value
382 */
384 return emplace(position, std::move(val));
385 }
386
387 /**
388 The array is extended by inserting a new element before the element at the
389 specified position. The element is constructed in-place.
390
391 This is generally an inefficient operation, since we need to copy
392 elements to make a new "hole" in the array.
393
394 We use std::rotate to move objects, hence Element_type must be
395 move-assignable and move-constructible.
396
397 @return an iterator pointing to the inserted value
398 */
399 template <typename... Args>
400 iterator emplace(const_iterator position, Args &&... args) {
401 const difference_type n = position - begin();
402 emplace_back(std::forward<Args>(args)...);
403 std::rotate(begin() + n, end() - 1, end());
404 return begin() + n;
405 }
406
407 /**
408 Similar to std::set<>::insert()
409 Extends the array by inserting a new element, but only if it cannot be found
410 in the array already.
411
412 Assumes that the array is sorted with std::less<Element_type>
413 Insertion using this function will maintain order.
414
415 @retval A pair, with its member pair::first set an iterator pointing to
416 either the newly inserted element, or to the equivalent element
417 already in the array. The pair::second element is set to true if
418 the new element was inserted, or false if an equivalent element
419 already existed.
420 */
421 std::pair<iterator, bool> insert_unique(const value_type &val) {
422 std::pair<iterator, iterator> p = std::equal_range(begin(), end(), val);
423 // p.first == p.second means we did not find it.
424 if (p.first == p.second) return std::make_pair(insert(p.first, val), true);
425 return std::make_pair(p.first, false);
426 }
427
428 /**
429 Similar to std::set<>::erase()
430 Removes a single element from the array by value.
431 The removed element is destroyed.
432 This effectively reduces the container size by one.
433
434 This is generally an inefficient operation, since we need to copy
435 elements to fill the "hole" in the array.
436
437 Assumes that the array is sorted with std::less<Element_type>.
438
439 @retval number of elements removed, 0 or 1.
440 */
442 std::pair<iterator, iterator> p = std::equal_range(begin(), end(), val);
443 if (p.first == p.second) return 0; // Not found
444 erase(p.first);
445 return 1;
446 }
447
448 /**
449 Similar to std::set<>::count()
450
451 @note Assumes that array is maintained with insert_unique/erase_unique.
452
453 @retval 1 if element is found, 0 otherwise.
454 */
456 return std::binary_search(begin(), end(), val);
457 }
458
459 /**
460 Removes a single element from the array.
461 The removed element is destroyed.
462 This effectively reduces the container size by one.
463
464 This is generally an inefficient operation, since we need to move
465 or copy elements to fill the "hole" in the array.
466
467 We use std::move to move objects, hence Element_type must be
468 move-assignable.
469 */
471 assert(position != end());
472 return erase(position - begin());
473 }
474
475 /**
476 Removes a single element from the array.
477 */
478 iterator erase(size_t ix) {
479 assert(ix < size());
480 iterator pos = begin() + ix;
481 if (pos + 1 != end()) std::move(pos + 1, end(), pos);
482 pop_back();
483 return pos;
484 }
485
486 /**
487 Removes tail elements from the array.
488 The removed elements are destroyed.
489 This effectively reduces the containers size by 'end() - first'.
490 */
493 const difference_type diff = last - first;
495 for (; first != last; ++first) first->~Element_type();
496 }
498 }
499
500 /**
501 Removes a range of elements from the array.
502 The removed elements are destroyed.
503 This effectively reduces the containers size by 'last - first'.
504
505 This is generally an inefficient operation, since we need to move
506 or copy elements to fill the "hole" in the array.
507
508 We use std::move to move objects, hence Element_type must be
509 move-assignable.
510 */
512 /*
513 std::move() wants non-const input iterators, otherwise it cannot move and
514 must always copy the elements. Convert first and last from const_iterator
515 to iterator.
516 */
517 iterator start = begin() + (first - cbegin());
518 iterator stop = begin() + (last - cbegin());
519 if (first != last) erase_at_end(std::move(stop, end(), start));
520 return start;
521 }
522
523 /**
524 Exchanges the content of the container by the content of rhs, which
525 is another vector object of the same type. Sizes may differ.
526
527 We use std::swap to do the operation.
528 */
530 // Just swap pointers if both arrays have done malloc.
531 if (!using_inline_buffer() && !rhs.using_inline_buffer()) {
536 return;
537 }
538 std::swap(*this, rhs);
539 }
540
541 /**
542 Requests the container to reduce its capacity to fit its size.
543 */
545 // Cannot shrink the pre-allocated array.
546 if (using_inline_buffer()) return;
547 // No point in swapping.
548 if (size() == capacity()) return;
550 if (size() <= Prealloc) {
551 /*
552 The elements fit in the pre-allocated array. Destruct the
553 heap-allocated array in this, and copy the elements into the
554 pre-allocated array.
555 */
556 this->~Prealloced_array();
557 new (this) Prealloced_array(tmp.m_psi_key, tmp.begin(), tmp.end());
558 } else {
559 // Both this and tmp have a heap-allocated array. Swap pointers.
560 swap(tmp);
561 }
562 }
563
564 /**
565 Resizes the container so that it contains n elements.
566
567 If n is smaller than the current container size, the content is
568 reduced to its first n elements, removing those beyond (and
569 destroying them).
570
571 If n is greater than the current container size, the content is
572 expanded by inserting at the end as many elements as needed to
573 reach a size of n. If val is specified, the new elements are
574 initialized as copies of val, otherwise, they are
575 value-initialized.
576
577 If n is also greater than the current container capacity, an automatic
578 reallocation of the allocated storage space takes place.
579
580 Notice that this function changes the actual content of the
581 container by inserting or erasing elements from it.
582 */
583 void resize(size_t n, const Element_type &val = Element_type()) {
584 if (n == size()) return;
585 if (n > size()) {
586 if (!reserve(n)) {
587 while (n != size()) push_back(val);
588 }
589 return;
590 }
592 while (n != size()) pop_back();
593 }
594 set_size(n);
595 }
596
597 /**
598 Removes (and destroys) all elements.
599 Does not change capacity.
600 */
601 void clear() {
603 for (Element_type *p = begin(); p != end(); ++p)
604 p->~Element_type(); // Destroy discarded element.
605 }
606 set_size(0);
607 }
608
609 private:
611
612 // If >= 0, we're using the inline storage in m_buff, and contains the real
613 // size. If negative, we're using external storage (m_array_ptr),
614 // and m_alloced_size contains the real size.
616
617 // Defined outside the union because we need an initializer to avoid
618 // "may be used uninitialized" for -flto builds, and
619 // MSVC rejects initializers for individual members of an anonymous union.
620 // (otherwise, we'd make it an anonymous struct, to avoid m_ext everywhere).
621 struct External {
622 Element_type *m_array_ptr;
625 };
626
627 union {
629 Element_type m_buff[Prealloc];
630 };
631};
632static_assert(sizeof(Prealloced_array<void *, 4>) <= 40,
633 "Check for no unexpected padding");
634
635#endif // PREALLOCED_ARRAY_INCLUDED
A typesafe replacement for DYNAMIC_ARRAY.
Definition: prealloced_array.h:71
bool push_back(const Element_type &element)
Copies an element into the back of the array.
Definition: prealloced_array.h:318
const Element_type & operator[](size_t n) const
Definition: prealloced_array.h:242
iterator erase(const_iterator first, const_iterator last)
Removes a range of elements from the array.
Definition: prealloced_array.h:511
Prealloced_array & operator=(const Prealloced_array &that)
Copies all the elements from 'that' into this container.
Definition: prealloced_array.h:183
size_type count_unique(const value_type &val) const
Similar to std::set<>::count()
Definition: prealloced_array.h:455
Prealloced_array(PSI_memory_key psi_key, const_iterator first, const_iterator last)
Range constructor.
Definition: prealloced_array.h:169
size_type erase_unique(const value_type &val)
Similar to std::set<>::erase() Removes a single element from the array by value.
Definition: prealloced_array.h:441
bool empty() const
Definition: prealloced_array.h:226
Prealloced_array(std::initializer_list< Element_type > elems)
Definition: prealloced_array.h:176
const Element_type & front() const
Definition: prealloced_array.h:248
Prealloced_array(PSI_memory_key psi_key)
Definition: prealloced_array.h:119
Element_type value_type
Standard typedefs.
Definition: prealloced_array.h:112
Prealloced_array(const Prealloced_array &that)
An object instance "owns" its array, so we do deep copy here.
Definition: prealloced_array.h:152
bool using_inline_buffer() const
Definition: prealloced_array.h:80
iterator erase(size_t ix)
Removes a single element from the array.
Definition: prealloced_array.h:478
bool emplace_back(Args &&... args)
Constructs an element at the back of the array.
Definition: prealloced_array.h:335
void clear()
Removes (and destroys) all elements.
Definition: prealloced_array.h:601
bool reserve(size_t n)
Reserves space for array elements.
Definition: prealloced_array.h:286
static constexpr bool Has_trivial_destructor
Is Element_type trivially destructible? If it is, we don't destroy elements when they are removed fro...
Definition: prealloced_array.h:77
Element_type & at(size_t n)
Definition: prealloced_array.h:231
Prealloced_array(Prealloced_array &&that)
Definition: prealloced_array.h:158
const Element_type & at(size_t n) const
Definition: prealloced_array.h:236
void resize(size_t n, const Element_type &val=Element_type())
Resizes the container so that it contains n elements.
Definition: prealloced_array.h:583
const_iterator cbegin() const
Returns a constant pointer to the first element in the array.
Definition: prealloced_array.h:259
static const size_t initial_capacity
Initial capacity of the array.
Definition: prealloced_array.h:109
void swap(Prealloced_array &rhs)
Exchanges the content of the container by the content of rhs, which is another vector object of the s...
Definition: prealloced_array.h:529
iterator insert(const_iterator position, value_type &&val)
The array is extended by inserting a new element before the element at the specified position.
Definition: prealloced_array.h:383
bool assign_at(size_t n, const value_type &val)
Assigns a value to an arbitrary element, even where n >= size().
Definition: prealloced_array.h:268
void pop_back()
Removes the last element in the array, effectively reducing the container size by one.
Definition: prealloced_array.h:349
~Prealloced_array()
Runs DTOR on all elements if needed.
Definition: prealloced_array.h:215
void set_size(size_t n)
Definition: prealloced_array.h:92
PSI_memory_key m_psi_key
Definition: prealloced_array.h:610
Element_type * buffer()
Gets the buffer in use.
Definition: prealloced_array.h:85
const Element_type & back() const
Definition: prealloced_array.h:245
Element_type * iterator
Definition: prealloced_array.h:116
iterator erase(const_iterator position)
Removes a single element from the array.
Definition: prealloced_array.h:470
Element_type & operator[](size_t n)
Definition: prealloced_array.h:241
size_t capacity() const
Definition: prealloced_array.h:222
const Element_type * buffer() const
Definition: prealloced_array.h:88
const_iterator cend() const
Returns a constant pointer to the past-the-end element in the array.
Definition: prealloced_array.h:261
void shrink_to_fit()
Requests the container to reduce its capacity to fit its size.
Definition: prealloced_array.h:544
iterator emplace(const_iterator position, Args &&... args)
The array is extended by inserting a new element before the element at the specified position.
Definition: prealloced_array.h:400
size_t size() const
Definition: prealloced_array.h:227
ptrdiff_t difference_type
Definition: prealloced_array.h:114
void erase_at_end(const_iterator first)
Removes tail elements from the array.
Definition: prealloced_array.h:491
Prealloced_array & operator=(Prealloced_array &&that)
Definition: prealloced_array.h:191
bool push_back(Element_type &&element)
Copies (or moves, if possible) an element into the back of the array.
Definition: prealloced_array.h:325
const_iterator begin() const
Definition: prealloced_array.h:256
Prealloced_array(PSI_memory_key psi_key, size_t initial_size)
Initializes (parts of) the array with default values.
Definition: prealloced_array.h:127
iterator begin()
begin : Returns a pointer to the first element in the array.
Definition: prealloced_array.h:254
Element_type & back()
Definition: prealloced_array.h:244
Element_type & front()
Definition: prealloced_array.h:247
std::pair< iterator, bool > insert_unique(const value_type &val)
Similar to std::set<>::insert() Extends the array by inserting a new element, but only if it cannot b...
Definition: prealloced_array.h:421
iterator end()
Definition: prealloced_array.h:255
iterator insert(const_iterator position, const value_type &val)
The array is extended by inserting a new element before the element at the specified position.
Definition: prealloced_array.h:367
size_t element_size() const
Definition: prealloced_array.h:225
const_iterator end() const
Definition: prealloced_array.h:257
External m_ext
Definition: prealloced_array.h:628
int m_inline_size
Definition: prealloced_array.h:615
const Element_type * const_iterator
Definition: prealloced_array.h:117
size_t size_type
Definition: prealloced_array.h:113
void adjust_size(int delta)
Definition: prealloced_array.h:99
Element_type m_buff[Prealloc]
Definition: prealloced_array.h:629
const char * p
Definition: ctype-mb.cc:1237
static Bigint * diff(Bigint *a, Bigint *b, Stack_alloc *alloc)
Definition: dtoa.cc:1082
#define MY_WME
Definition: my_sys.h:123
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:177
Header for compiler-dependent features.
Some integer typedefs for easier portability.
#define MYF(v)
Definition: my_inttypes.h:97
void * my_malloc(PSI_memory_key key, size_t size, int flags)
Allocates size bytes of memory.
Definition: my_memory.cc:57
void my_free(void *ptr)
Frees the memory pointed by the ptr.
Definition: my_memory.cc:81
Common header for many mysys elements.
Performance schema instrumentation interface.
static MEM_ROOT mem
Definition: sql_servers.cc:99
static void swap(String &a, String &b) noexcept
Definition: sql_string.h:642
Definition: prealloced_array.h:621
size_t m_alloced_size
Definition: prealloced_array.h:623
size_t m_alloced_capacity
Definition: prealloced_array.h:624
Element_type * m_array_ptr
Definition: prealloced_array.h:622
#define PSI_NOT_INSTRUMENTED
Definition: validate_password_imp.cc:42
int n
Definition: xcom_base.cc:509