1 // Created on: 2011-07-11
2 // Created by: Kirill GAVRILOV
3 // Copyright (c) 2002-2014 OPEN CASCADE SAS
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef NCollection_WinHeapAllocator_HeaderFile
17 #define NCollection_WinHeapAllocator_HeaderFile
19 #include <NCollection_BaseAllocator.hxx>
21 //! This memory allocator creates dedicated heap for allocations.
22 //! This technics available only on Windows platform
23 //! (no alternative on Unix systems).
24 //! It may be used to take control over memory fragmentation
25 //! because on destruction ALL allocated memory will be released
28 //! This allocator can also be created per each working thread
29 //! hovewer it real multi-threading performance is dubious.
31 //! Notice that this also means that existing pointers will be broken
32 //! and you shoould control that allocator is alive along all objects
33 //! allocated with him.
34 class NCollection_WinHeapAllocator : public NCollection_BaseAllocator
39 Standard_EXPORT NCollection_WinHeapAllocator (const size_t theInitSizeBytes = 0x80000);
42 Standard_EXPORT virtual ~NCollection_WinHeapAllocator();
45 Standard_EXPORT virtual void* Allocate (const Standard_Size theSize) Standard_OVERRIDE;
48 Standard_EXPORT virtual void Free (void* theAddress) Standard_OVERRIDE;
50 // Declaration of CASCADE RTTI
51 DEFINE_STANDARD_RTTIEXT(NCollection_WinHeapAllocator,NCollection_BaseAllocator)
54 //! Copy constructor - prohibited
55 NCollection_WinHeapAllocator (const NCollection_WinHeapAllocator& );
58 #if(defined(_WIN32) || defined(__WIN32__))
61 Standard_Boolean myToZeroMemory;
65 // Definition of HANDLE object using Standard_DefineHandle.hxx
66 DEFINE_STANDARD_HANDLE (NCollection_WinHeapAllocator, NCollection_BaseAllocator)
68 #endif //NCollection_WinHeapAllocator_HeaderFile