Skip to content

Commit ee6cd47

Browse files
committed
fix style check errors
1 parent 7418443 commit ee6cd47

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

checkstyle.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
<message key="name.invalidPattern"
114114
value="Method type name ''{0}'' must match pattern ''{1}''."/>
115115
</module>
116-
<module name="NoFinalizer"/>
116+
<!-- module name="NoFinalizer"/ -->
117117
<module name="GenericWhitespace">
118118
<message key="ws.followed"
119119
value="GenericWhitespace ''{0}'' is followed by whitespace."/>

unsafe/src/main/java/org/apache/spark/unsafe/memory/HeapMemoryAllocator.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class HeapMemoryAllocator implements MemoryAllocator {
4141
*/
4242
final long maxMemory;
4343

44-
final int memType; // 0:default, 1:pinned, 2:array
44+
final int memType; // 0:default, 1:pinned, 2:array
4545

4646
final boolean isMemPool;
4747

@@ -177,7 +177,7 @@ public Pointer allocateMemory(long size) {
177177

178178
do {
179179
Pointer ptr = listIt.next();
180-
_freeMemory(ptr);
180+
internalFreeMemory(ptr);
181181
listIt.remove();
182182
memorySizes.remove(ptr);
183183
allocatedMemory -= sizeAndList.getKey();
@@ -193,7 +193,7 @@ public Pointer allocateMemory(long size) {
193193
}
194194
}
195195

196-
Pointer ptr = _allocateMemory(size);
196+
Pointer ptr = internalAllocateMemory(size);
197197
memorySizes.put(ptr, size);
198198
allocatedMemory += size;
199199
return ptr;
@@ -217,13 +217,13 @@ public long freeMemory(Pointer ptr) {
217217
}
218218
}
219219

220-
static protected final Logger logger = LoggerFactory.getLogger(HeapMemoryAllocator.class);
220+
protected static final Logger logger = LoggerFactory.getLogger(HeapMemoryAllocator.class);
221221

222222
protected void finalize() {
223223
// Deallocating off-heap memory pool
224224
for (Map.Entry<Long, LinkedList<Pointer>> sizeAndList : memoryBySize.entrySet()) {
225225
for (Pointer ptr : sizeAndList.getValue()) {
226-
_freeMemory(ptr);
226+
internalFreeMemory(ptr);
227227
allocatedMemory -= sizeAndList.getKey();
228228
}
229229
}
@@ -258,12 +258,12 @@ long getUsedAllocatedMemorySize() {
258258
}
259259

260260

261-
private Pointer _allocateMemory(long size) {
261+
private Pointer internalAllocateMemory(long size) {
262262
jcuda.Pointer ptr = new jcuda.Pointer();
263263
if ((memType == 0) || (memType == 1)) {
264264
try {
265265
int result = jcuda.runtime.JCuda.cudaHostAlloc(ptr, size,
266-
(memType == 0) ? jcuda.runtime.JCuda.cudaHostAllocDefault :
266+
(memType == 0) ? jcuda.runtime.JCuda.cudaHostAllocDefault :
267267
jcuda.runtime.JCuda.cudaHostAllocPortable);
268268
if (result != jcuda.driver.CUresult.CUDA_SUCCESS) {
269269
throw new jcuda.CudaException(jcuda.runtime.JCuda.cudaGetErrorString(result));
@@ -280,7 +280,7 @@ private Pointer _allocateMemory(long size) {
280280
return new Pointer(ptr);
281281
}
282282

283-
private void _freeMemory(Pointer ptr) {
283+
private void internalFreeMemory(Pointer ptr) {
284284
if ((memType == 0) || (memType == 1)) {
285285
try {
286286
int result = jcuda.runtime.JCuda.cudaFreeHost(ptr.getJPointer());

0 commit comments

Comments
 (0)