mirror of
https://github.com/apache/nuttx.git
synced 2026-06-04 14:53:47 +08:00
mm: memory pressure support returns the maximum available memory
Signed-off-by: yinshengkai <yinshengkai@xiaomi.com>
This commit is contained in:
@@ -78,7 +78,8 @@ FAR void *calloc(size_t n, size_t elem_size)
|
||||
}
|
||||
else
|
||||
{
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP));
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP),
|
||||
mm_heapfree_largest(USR_HEAP));
|
||||
}
|
||||
|
||||
return mem;
|
||||
|
||||
@@ -68,7 +68,8 @@ FAR void *malloc(size_t size)
|
||||
}
|
||||
else
|
||||
{
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP));
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP),
|
||||
mm_heapfree_largest(USR_HEAP));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -95,7 +95,8 @@ FAR void *memalign(size_t alignment, size_t size)
|
||||
}
|
||||
else
|
||||
{
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP));
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP),
|
||||
mm_heapfree_largest(USR_HEAP));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -97,7 +97,8 @@ FAR void *realloc(FAR void *oldmem, size_t size)
|
||||
}
|
||||
else
|
||||
{
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP));
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP),
|
||||
mm_heapfree_largest(USR_HEAP));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
@@ -74,7 +74,8 @@ FAR void *zalloc(size_t size)
|
||||
}
|
||||
else
|
||||
{
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP));
|
||||
mm_notify_pressure(mm_heapfree(USR_HEAP),
|
||||
mm_heapfree_largest(USR_HEAP));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user