diff --git a/sci-ml/caffe2/caffe2-2.10.0-r1.ebuild b/sci-ml/caffe2/caffe2-2.10.0-r2.ebuild
similarity index 98%
rename from sci-ml/caffe2/caffe2-2.10.0-r1.ebuild
rename to sci-ml/caffe2/caffe2-2.10.0-r2.ebuild
index 559439f586d2b..de19280d828d9 100644
--- a/sci-ml/caffe2/caffe2-2.10.0-r1.ebuild
+++ b/sci-ml/caffe2/caffe2-2.10.0-r2.ebuild
@@ -44,8 +44,8 @@ S="${WORKDIR}"/${MYP}
LICENSE="BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
-IUSE="cuda cusparselt distributed fbgemm flash gloo memefficient mkl mpi nccl nnpack +numpy
- onednn openblas opencl openmp qnnpack rocm xnnpack"
+IUSE="cuda cusparselt distributed fbgemm flash gloo memefficient mimalloc mkl
+ mpi nccl nnpack +numpy onednn openblas opencl openmp qnnpack rocm xnnpack"
RESTRICT="test"
REQUIRED_USE="
${PYTHON_REQUIRED_USE}
@@ -81,6 +81,7 @@ RDEPEND="
)
fbgemm? ( sci-ml/FBGEMM )
gloo? ( >=sci-ml/gloo-2025.06.04[cuda?,rocm?] )
+ mimalloc? ( dev-libs/mimalloc )
mpi? ( virtual/mpi )
nnpack? (
sci-ml/NNPACK
@@ -163,6 +164,7 @@ PATCHES=(
"${FILESDIR}"/${PN}-2.9.0-rocm-distributed-link.patch
"${FILESDIR}"/${PN}-2.9.1-torch_cpu.patch
"${FILESDIR}"/${P}-gentoo.patch
+ "${FILESDIR}"/${P}-mimalloc.patch
)
src_prepare() {
@@ -291,6 +293,7 @@ src_configure() {
-DUSE_KLEIDIAI=OFF # TODO
-DUSE_MAGMA=OFF # TODO: In GURU as sci-libs/magma
-DUSE_MEM_EFF_ATTENTION=$(usex memefficient)
+ -DUSE_MIMALLOC=$(usex mimalloc)
-DUSE_MKLDNN=$(usex onednn)
-DUSE_MPI=$(usex mpi)
-DUSE_NCCL=OFF
diff --git a/sci-ml/caffe2/files/caffe2-2.10.0-mimalloc.patch b/sci-ml/caffe2/files/caffe2-2.10.0-mimalloc.patch
new file mode 100644
index 0000000000000..ed859776febed
--- /dev/null
+++ b/sci-ml/caffe2/files/caffe2-2.10.0-mimalloc.patch
@@ -0,0 +1,14 @@
+--- a/c10/CMakeLists.txt 2026-02-01 09:22:55.398151644 +0100
++++ b/c10/CMakeLists.txt 2026-02-01 09:30:46.720495230 +0100
+@@ -120,8 +120,9 @@
+ endif()
+
+ if(USE_MIMALLOC)
+- target_link_libraries(c10 PRIVATE "mimalloc-static")
+- add_dependencies(c10 mimalloc-static)
++ find_package(mimalloc REQUIRED)
++ target_link_libraries(c10 PRIVATE "mimalloc")
++ add_dependencies(c10 mimalloc)
+ endif()
+
+ if(LINUX)
diff --git a/sci-ml/caffe2/metadata.xml b/sci-ml/caffe2/metadata.xml
index 16e166ccaf7b8..519739396a46f 100644
--- a/sci-ml/caffe2/metadata.xml
+++ b/sci-ml/caffe2/metadata.xml
@@ -12,6 +12,7 @@
Enable flash attention
Use sci-ml/gloo
Enable mem efficient attention
+ Use dev-libs/mimalloc as replacement for system malloc
Use sci-libs/mkl for blas, lapack and sparse blas routines
Use sci-ml/NNPACK
Add support for math operations through numpy