Skip to content

Commit 4e2f81c

Browse files
authored
Provide more information on mmap/munmap failure
for #2207
1 parent abea977 commit 4e2f81c

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

driver/others/memory.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,8 +2041,12 @@ static BLASULONG alloc_lock = 0UL;
20412041

20422042
static void alloc_mmap_free(struct release_t *release){
20432043

2044+
if (!release->address) return 0;
2045+
20442046
if (munmap(release -> address, BUFFER_SIZE)) {
2045-
printf("OpenBLAS : munmap failed\n");
2047+
int errsv=errno;
2048+
perror("OpenBLAS : munmap failed:");
2049+
printf("error code=%d,\trelease->address=%lx\n",errsv,release->address);
20462050
}
20472051
}
20482052

@@ -2073,6 +2077,12 @@ static void *alloc_mmap(void *address){
20732077
#if (defined(SMP) || defined(USE_LOCKING)) && !defined(USE_OPENMP)
20742078
UNLOCK_COMMAND(&alloc_lock);
20752079
#endif
2080+
} else {
2081+
#ifdef DEBUG
2082+
int errsv=errno;
2083+
perror("OpenBLAS : mmap failed:");
2084+
printf("error code=%d,\tmap_address=%lx\n",errsv,map_address);
2085+
#endif
20762086
}
20772087

20782088
#ifdef OS_LINUX

0 commit comments

Comments
 (0)