Pac-Man Evolution
Toggle main menu visibility
Main Page
Files
File List
Loading...
Searching...
No Matches
source
MemoryManager.h
1
/*----------------------------------------------------------------------
2
Pac-Man Evolution - Roberto Prieto
3
Copyright (C) 2018-2024 MegaStorm Systems
4
contact@megastormsystems.com - http://www.megastormsystems.com
5
6
This software is provided 'as-is', without any express or implied
7
warranty. In no event will the authors be held liable for any damages
8
arising from the use of this software.
9
10
Permission is granted to anyone to use this software for any purpose,
11
including commercial applications, and to alter it and redistribute it
12
freely, subject to the following restrictions:
13
14
1. The origin of this software must not be misrepresented; you must not
15
claim that you wrote the original software. If you use this software
16
in a product, an acknowledgment in the product documentation would be
17
appreciated but is not required.
18
2. Altered source versions must be plainly marked as such, and must not be
19
misrepresented as being the original software.
20
3. This notice may not be removed or altered from any source distribution.
21
22
------------------------------------------------------------------------
23
24
Memory Manager
25
26
------------------------------------------------------------------------ */
27
28
#ifndef MEMORYMANAGERPME_H
29
#define MEMORYMANAGERPME_H
30
31
// Includes
32
#if __has_include(<CRM64Pro/CRM64Pro.h>)
33
#include <CRM64Pro/CRM64Pro.h>
34
#else
35
#include <CRM64Pro.h>
36
#endif
37
using namespace
CRM64Pro;
38
39
// Enable or disable the memory manager
40
#define USE_CMEM
41
42
// Use of CMem memory manager
43
#ifdef USE_CMEM
44
class
CMemPME
45
{
46
public
:
47
// These are the only needed operators. It could be extended if needed.
48
void
*
operator
new
(size_t,
const
std::nothrow_t&);
49
void
operator
delete
(
void
*,
const
std::nothrow_t&);
50
void
operator
delete
(
void
*);
51
};
52
#define _PME_ALLOC(type,size) (type*)CRM64Pro::CMem::alloc(sizeof(type) * (size), 1)
53
#define _PME_FREE(p) CRM64Pro::CMem::free(p)
54
#else
55
class
CMemPME {};
56
#define _PME_ALLOC(type, size) new(std::nothrow) type[size]
57
#define _PME_FREE(p) delete[]p
58
#endif
59
60
#endif
Generated by
1.9.6