| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#include <aws/common/byte_buf.h> |
| 7 |
#include <aws/common/device_random.h> |
| 8 |
#include <aws/common/system_resource_util.h> |
| 9 |
|
| 10 |
#include <aws/testing/aws_test_harness.h> |
| 11 |
|
| 12 |
static int s_test_memory_usage_maxrss(struct aws_allocator *allocator, void *ctx) { |
| 13 |
(void)ctx; |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
struct aws_byte_buf temp; |
| 24 |
aws_byte_buf_init(&temp, allocator, 8 * 1024 * 1024); |
| 25 |
ASSERT_SUCCESS(aws_device_random_buffer(&temp)); |
| 26 |
|
| 27 |
struct aws_memory_usage_stats mu; |
| 28 |
ASSERT_SUCCESS(aws_init_memory_usage_for_current_process(&mu)); |
| 29 |
|
| 30 |
ASSERT_TRUE(mu.maxrss > 0); |
| 31 |
|
| 32 |
aws_byte_buf_clean_up_secure(&temp); |
| 33 |
|
| 34 |
return 0; |
| 35 |
} |
| 36 |
|
| 37 |
AWS_TEST_CASE(test_memory_usage_maxrss, s_test_memory_usage_maxrss) |