Skip to content

Commit 40d9f97

Browse files
Use memory constants instead of hard coded values.
Change-Id: I4be62ec34cb7b7bcdeebb4ff82abe0c17f59af85
1 parent 129380c commit 40d9f97

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

runtime/memory_manager/os_agnostic_memory_manager.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ Allocator32bit *OsAgnosticMemoryManager::create32BitAllocator(bool aubUsage) {
255255
}
256256

257257
if (DebugManager.flags.UseMallocToObtainHeap32Base.get()) {
258-
size_t allocationSize = 40 * 1024 * 1024u;
258+
size_t allocationSize = 40 * MemoryConstants::megaByte;
259259
allocatorSize = static_cast<uint64_t>(allocationSize);
260260
heap32Base = castToUint64(alignedMallocWrapper(allocationSize, MemoryConstants::allocationAlignment));
261261
}

runtime/utilities/heap_allocator.h

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
/*
2-
* Copyright (c) 2017, Intel Corporation
2+
* Copyright (C) 2017-2018 Intel Corporation
33
*
4-
* Permission is hereby granted, free of charge, to any person obtaining a
5-
* copy of this software and associated documentation files (the "Software"),
6-
* to deal in the Software without restriction, including without limitation
7-
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8-
* and/or sell copies of the Software, and to permit persons to whom the
9-
* Software is furnished to do so, subject to the following conditions:
4+
* SPDX-License-Identifier: MIT
105
*
11-
* The above copyright notice and this permission notice shall be included
12-
* in all copies or substantial portions of the Software.
13-
*
14-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15-
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17-
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18-
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19-
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20-
* OTHER DEALINGS IN THE SOFTWARE.
216
*/
227

238
#pragma once
@@ -155,7 +140,7 @@ class HeapAllocator {
155140
uint64_t size;
156141
uint64_t availableSize;
157142
uint64_t pLeftBound, pRightBound;
158-
const size_t defaultSizeThreshold = 4096 * 1024;
143+
const size_t defaultSizeThreshold = 4 * MemoryConstants::megaByte;
159144
const size_t sizeThreshold;
160145
size_t allocationAlignment = MemoryConstants::pageSize;
161146

0 commit comments

Comments
 (0)