projects
/
mono.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
9719dd2
)
[utils] Fix mono_valloc and mono_valloc_aligned malloc-based implementation.
author
Rodrigo Kumpera
<kumpera@gmail.com>
Tue, 22 Aug 2017 20:02:10 +0000
(13:02 -0700)
committer
Rodrigo Kumpera
<kumpera@gmail.com>
Wed, 23 Aug 2017 20:57:17 +0000
(13:57 -0700)
mono/utils/mono-mmap.c
patch
|
blob
|
history
diff --git
a/mono/utils/mono-mmap.c
b/mono/utils/mono-mmap.c
index af8df3236f710ee1b3bf5c5bf0482c21386a4073..3fa797bbd99dcb06b756647189b34b4b1420d476 100644
(file)
--- a/
mono/utils/mono-mmap.c
+++ b/
mono/utils/mono-mmap.c
@@
-380,13
+380,17
@@
mono_valloc_granule (void)
void*
mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
{
void*
mono_valloc (void *addr, size_t length, int flags, MonoMemAccountType type)
{
- return g_malloc (length);
+ g_assert (addr == NULL);
+ return mono_valloc_aligned (length, mono_pagesize (), flags, type);
}
void*
mono_valloc_aligned (size_t size, size_t alignment, int flags, MonoMemAccountType type)
{
}
void*
mono_valloc_aligned (size_t size, size_t alignment, int flags, MonoMemAccountType type)
{
- g_assert_not_reached ();
+ void *res = NULL;
+ if (posix_memalign (&res, alignment, size))
+ return NULL;
+ return res;
}
#define HAVE_VALLOC_ALIGNED
}
#define HAVE_VALLOC_ALIGNED