GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — async-profiler/src/linearAllocator.h at jonoffcpu-dev · jonoffcpu/async-profiler Expand file tree/ Copy pathlinearAllocator.hMore file actions 44 lines (33 loc) · 787 Bytes / Copy pathlinearAllocator.hFile metadata and controls44 lines (33 loc) · 787 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 /* * Copyright The async-profiler authors * SPDX-License-Identifier: Apache-2.0 */ #ifndef _LINEARALLOCATOR_H #define _LINEARALLOCATOR_H #include <stddef.h> struct Chunk { Chunk* prev; volatile size_t offs; // To avoid false sharing char _padding[56]; }; class LinearAllocator { private: size_t _chunk_size; size_t _used_memory; Chunk* _tail; Chunk* _reserve; Chunk* allocateChunk(Chunk* current); void freeChunk(Chunk* current); void reserveChunk(Chunk* current); Chunk* getNextChunk(Chunk* current); public: LinearAllocator(size_t chunk_size); ~LinearAllocator(); size_t usedMemory() const { return _used_memory; } void clear(); void* alloc(size_t size); }; #endif // _LINEARALLOCATOR_H |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |