Avoid importing memory aligned malloc (#13693)

This PR is based on the commits from PR
https://github.com/valkey-io/valkey/pull/1442.

We deprecate the usage of classic malloc and free, but under certain
circumstances they might get imported from intrinsics. The original
thought is we should just override malloc and free to use zmalloc and
zfree, but I think we should continue to deprecate it to avoid
accidental imports of allocations.

---------

Co-authored-by: Madelyn Olson <matolson@amazon.com>
This commit is contained in:
debing.sun 2024-12-20 09:39:14 +08:00 committed by GitHub
parent 684077682e
commit 1f09a55eba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -4,8 +4,13 @@
* Copyright (c) 2014-Present, Redis Ltd.
* All rights reserved.
*
* Copyright (c) 2024-present, Valkey contributors.
* All rights reserved.
*
* Licensed under your choice of the Redis Source Available License 2.0
* (RSALv2) or the Server Side Public License v1 (SSPLv1).
*
* Portions of this file are available under BSD3 terms; see REDISCONTRIBUTIONS for more information.
*/
#include "server.h"
@ -14,6 +19,9 @@
#include <math.h>
#ifdef HAVE_AVX2
/* Define __MM_MALLOC_H to prevent importing the memory aligned
* allocation functions, which we don't use. */
#define __MM_MALLOC_H
#include <immintrin.h>
#endif