2020-06-15 04:38:55 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* include/malloc.h
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __INCLUDE_MALLOC_H
|
|
|
|
#define __INCLUDE_MALLOC_H
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2020-08-19 16:13:36 +02:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2020-06-15 04:38:55 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2021-06-26 21:57:56 +02:00
|
|
|
/* For Linux and MacOS compatibility */
|
|
|
|
|
|
|
|
#define malloc_usable_size malloc_size
|
|
|
|
|
2020-06-15 04:38:55 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Type Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
struct mallinfo
|
|
|
|
{
|
|
|
|
int arena; /* This is the total size of memory allocated
|
|
|
|
* for use by malloc in bytes. */
|
|
|
|
int ordblks; /* This is the number of free (not in use) chunks */
|
2021-04-28 05:05:20 +02:00
|
|
|
int aordblks; /* This is the number of allocated (in use) chunks */
|
2020-06-15 04:38:55 +02:00
|
|
|
int mxordblk; /* Size of the largest free (not in use) chunk */
|
|
|
|
int uordblks; /* This is the total size of memory occupied by
|
|
|
|
* chunks handed out by malloc. */
|
|
|
|
int fordblks; /* This is the total size of memory occupied
|
|
|
|
* by free (not in use) chunks. */
|
|
|
|
};
|
|
|
|
|
2022-01-22 13:21:51 +01:00
|
|
|
struct mallinfo_task
|
|
|
|
{
|
|
|
|
pid_t pid; /* The pid of task */
|
|
|
|
int aordblks; /* This is the number of allocated (in use) chunks for task */
|
|
|
|
int uordblks; /* This is the total size of memory occupied for task */
|
|
|
|
};
|
|
|
|
|
2020-06-15 04:38:55 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct mallinfo mallinfo(void);
|
2021-06-26 21:57:56 +02:00
|
|
|
size_t malloc_size(FAR void *ptr);
|
2022-01-22 13:21:51 +01:00
|
|
|
struct mallinfo_task mallinfo_task(pid_t pid);
|
2020-06-15 04:38:55 +02:00
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __INCLUDE_MALLOC_H */
|