Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 09:17:00

0001 // Created on: 2005-03-15
0002 // Created by: Peter KURNEV
0003 // Copyright (c) 2005-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 _Standard_MMgrRoot_HeaderFile
0017 #define _Standard_MMgrRoot_HeaderFile
0018 
0019 #include <Standard_TypeDef.hxx>
0020 
0021 /**
0022  * Root class for Open CASCADE mmemory managers.
0023  * Defines only abstract interface functions.
0024  */
0025 
0026 class Standard_MMgrRoot
0027 {
0028 public:
0029   //! Virtual destructor; required for correct inheritance
0030   Standard_EXPORT virtual ~Standard_MMgrRoot();
0031 
0032   //! Allocate specified number of bytes.
0033   //! The actually allocated space should be rounded up to
0034   //! double word size (4 bytes), as this is expected by implementation
0035   //! of some classes in OCC (e.g. TCollection_AsciiString)
0036   Standard_EXPORT virtual void* Allocate(const size_t theSize) = 0;
0037 
0038   //! Reallocate previously allocated memory to contain at least theSize bytes.
0039   //! In case of success, new pointer is returned.
0040   Standard_EXPORT virtual void* Reallocate(void* thePtr, const size_t theSize) = 0;
0041 
0042   //! Frees previously allocated memory at specified address.
0043   Standard_EXPORT virtual void Free(void* thePtr) = 0;
0044 
0045   //! Purge internally cached unused memory blocks (if any)
0046   //! by releasing them to the operating system.
0047   //! Must return non-zero if some memory has been actually released,
0048   //! or zero otherwise.
0049   //!
0050   //! If option isDestroyed is True, this means that memory
0051   //! manager is not expected to be used any more; note however
0052   //! that in general case it is still possible to have calls to that
0053   //! instance of memory manager after this (e.g. to free memory
0054   //! of static objects in OCC). Thus this option should
0055   //! command the memory manager to release any cached memory
0056   //! to the system and not cache any more, but still remain operable...
0057   //!
0058   //! Default implementation does nothing and returns 0.
0059   Standard_EXPORT virtual int Purge(bool isDestroyed = false);
0060 };
0061 
0062 #endif