|
|
|||
File indexing completed on 2026-09-25 09:20:42
0001 // Created on: 2011-07-11 0002 // Created by: Kirill GAVRILOV 0003 // Copyright (c) 2002-2014 OPEN CASCADE SAS 0004 // 0005 // This file is part of Open CASCADE Technology software library. 0006 // 0007 // This library is free software; you can redistribute it and/or modify it under 0008 // the terms of the GNU Lesser General Public License version 2.1 as published 0009 // by the Free Software Foundation, with special exception defined in the file 0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT 0011 // distribution for complete text of the license and disclaimer of any warranty. 0012 // 0013 // Alternatively, this file may be used under the terms of Open CASCADE 0014 // commercial license or contractual agreement. 0015 0016 #ifndef NCollection_WinHeapAllocator_HeaderFile 0017 #define NCollection_WinHeapAllocator_HeaderFile 0018 0019 #include <NCollection_BaseAllocator.hxx> 0020 0021 //! This memory allocator creates dedicated heap for allocations. 0022 //! This technics available only on Windows platform 0023 //! (no alternative on Unix systems). 0024 //! It may be used to take control over memory fragmentation 0025 //! because on destruction ALL allocated memory will be released 0026 //! to the system. 0027 //! 0028 //! This allocator can also be created per each working thread 0029 //! however its real multi-threading performance is dubious. 0030 //! 0031 //! Notice that this also means that existing pointers will be broken 0032 //! and you should control that allocator is alive along all objects 0033 //! allocated with him. 0034 class NCollection_WinHeapAllocator : public NCollection_BaseAllocator 0035 { 0036 public: 0037 //! Main constructor 0038 Standard_EXPORT NCollection_WinHeapAllocator(const size_t theInitSizeBytes = 0x80000); 0039 0040 //! Destructor 0041 Standard_EXPORT ~NCollection_WinHeapAllocator() override; 0042 0043 //! Allocate memory 0044 Standard_EXPORT void* Allocate(const size_t theSize) override; 0045 0046 //! Allocate memory 0047 void* AllocateOptimal(const size_t theSize) override { return Allocate(theSize); } 0048 0049 //! Release memory 0050 Standard_EXPORT void Free(void* theAddress) override; 0051 0052 // Declaration of CASCADE RTTI 0053 DEFINE_STANDARD_RTTIEXT(NCollection_WinHeapAllocator, NCollection_BaseAllocator) 0054 0055 private: 0056 //! Copy constructor - prohibited 0057 NCollection_WinHeapAllocator(const NCollection_WinHeapAllocator&) = delete; 0058 0059 private: 0060 #if (defined(_WIN32) || defined(__WIN32__)) 0061 void* myHeapH; 0062 #endif 0063 [[maybe_unused]] bool myToZeroMemory; 0064 }; 0065 0066 // Definition of HANDLE object using Standard_DefineHandle.hxx 0067 #endif // NCollection_WinHeapAllocator_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|