-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
149 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
custom: ['paypal.me/tilz0R'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Changelog | ||
|
||
## Develop | ||
|
||
## v1.5.0 | ||
|
||
- Add option to cleanup memory on free and realloc operations | ||
|
||
## v1.4.0 | ||
|
||
- New artistic code style | ||
- Replace configuration | ||
- Several bug fixes | ||
|
||
## v1.3.0 | ||
|
||
- Added option for custom LwMEM instance for complete isolation | ||
- Added `_ex` functions for extended features for custom instances | ||
- Added macros for backward-compatible, default instance, allocation functions | ||
- Added option to force LwMEM to allocate memory at specific region | ||
- Added win32 examples | ||
|
||
## v1.2.0 | ||
|
||
- Fix comments to easily undestand architecture | ||
- Migrate examples to CMSIS-OS v2 | ||
- Use pre-increment instead of post-increment | ||
- Other C code style fixes | ||
|
||
## v1.1.0 | ||
|
||
- Added support for thread-safety application | ||
- Added boundary check of all internal pointers | ||
- Added tests code directly in library | ||
- Bug fixes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
@@ -42,7 +42,9 @@ | |
* Open "include/lwmem/lwmem_opt.h" and | ||
* copy & replace here settings you want to change values | ||
*/ | ||
#define LWMEM_CFG_OS 1 | ||
#define LWMEM_CFG_OS_MUTEX_HANDLE HANDLE | ||
#define LWMEM_CFG_OS 1 | ||
#define LWMEM_CFG_OS_MUTEX_HANDLE HANDLE | ||
#define LWMEM_CFG_ENABLE_STATS 0 | ||
#define LWMEM_CFG_CLEAN_MEMORY 1 | ||
|
||
#endif /* OW_HDR_OPTS_H */ | ||
#endif /* LWMEM_HDR_OPTS_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<mxfile host="Electron" modified="2020-12-05T00:19:20.329Z" agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) draw.io/12.3.2 Chrome/78.0.3904.113 Electron/7.1.2 Safari/537.36" etag="V0MvXZe_QYE6MFCmOuaH" version="12.3.2" type="device" pages="1"><diagram id="Wsjaadh77UIxB9X1bxos" name="Page-1">jZLLbsMgEEW/xstItkmiZNs0TaUm2WSRNTITgwoei+Di9OuL68EPRZW6gjnzAO4lYTvTHiyv5QkF6CRPRZuw1yTPs3SzCUtHHj3ZrgmUVgkqGsFFfUPsJNooAfdZoUPUTtVzWGBVQeFmjFuLfl52Qz0/teYlPIFLwfUzvSrhZE83q3Tk76BKGU/OUsoYHosJ3CUX6CeI7RO2s4iu35l2B7oTL+rS9739kR0uZqFy/2k4L8QStsYfz6Z5WW4/bvqaLWjKF9cNPfjoT/sT3dg9ogwWm0pANylL2IuXysGl5kWX9cH4wKQzmtJ3Z/FzkGsdyA0rR96yLh60SEPw/JB4K7AO2gmihx0ADTj7CCWUZctV30K/LI+xHz3L1mSEnPgVfeT0Tcph9Khk2JCYMRxN+81Nvj7b/wA=</diagram></mxfile> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef __MAIN_H | ||
#define __MAIN_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#include "main.h" | ||
#include "cmsis_os.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef __MAIN_H | ||
#define __MAIN_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
* OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#include "main.h" | ||
#include "lwmem/lwmem.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,12 +29,11 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_H | ||
#define LWMEM_HDR_H | ||
|
||
#include <string.h> | ||
#include <stdint.h> | ||
#include <limits.h> | ||
#include "lwmem/lwmem_opt.h" | ||
|
@@ -67,6 +66,14 @@ typedef struct lwmem_block { | |
or `0` when block is considered free */ | ||
} lwmem_block_t; | ||
|
||
/** | ||
* \brief Statistics structure | ||
*/ | ||
typedef struct { | ||
uint32_t nr_alloc; /*!< Number of all allocated blocks in single instance */ | ||
uint32_t nr_free; /*!< Number of frees in the LwMEM instance */ | ||
} lwmem_stats_t; | ||
|
||
/** | ||
* \brief LwMEM main structure | ||
*/ | ||
|
@@ -78,6 +85,9 @@ typedef struct lwmem { | |
#if LWMEM_CFG_OS || __DOXYGEN__ | ||
LWMEM_CFG_OS_MUTEX_HANDLE mutex; /*!< System mutex for OS */ | ||
#endif /* LWMEM_CFG_OS || __DOXYGEN__ */ | ||
#if LWMEM_CFG_ENABLE_STATS || __DOXYGEN__ | ||
lwmem_stats_t stats; /*!< Statistics */ | ||
#endif /* LWMEM_CFG_ENABLE_STATS || __DOXYGEN__ */ | ||
#if defined(LWMEM_DEV) && !__DOXYGEN__ | ||
lwmem_block_t start_block_first_use; /*!< Value of start block for very first time. | ||
This is used only during validation process and is removed in final use */ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,11 +29,14 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPT_H | ||
#define LWMEM_HDR_OPT_H | ||
|
||
/* Uncomment to ignore user options (or set macro in compiler flags) */ | ||
/* #define LWMEM_IGNORE_USER_OPTS */ | ||
|
||
/* Include application options */ | ||
#ifndef LWMEM_IGNORE_USER_OPTS | ||
#include "lwmem_opts.h" | ||
|
@@ -82,6 +85,24 @@ extern "C" { | |
#define LWMEM_CFG_ALIGN_NUM ((size_t)4) | ||
#endif | ||
|
||
/** | ||
* \brief Enables `1` or disables `0` memory cleanup on free operation (or realloc). | ||
* | ||
* It resets unused memory to `0x00` and prevents other applications seeing old data. | ||
* It is disabled by default since it has performance penalties. | ||
* / | ||
#ifndef LWMEM_CFG_CLEAN_MEMORY | ||
#define LWMEM_CFG_CLEAN_MEMORY 0 | ||
#endif | ||
/** | ||
* \brief Enables `1` or disables `0` statistics in the library | ||
* | ||
*/ | ||
#ifndef LWMEM_CFG_ENABLE_STATS | ||
#define LWMEM_CFG_ENABLE_STATS 0 | ||
#endif | ||
|
||
/** | ||
* \} | ||
*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_OPTS_H | ||
#define LWMEM_HDR_OPTS_H | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ | |
* This file is part of LwMEM - Lightweight dynamic memory manager library. | ||
* | ||
* Author: Tilen MAJERLE <[email protected]> | ||
* Version: v1.4.0 | ||
* Version: v1.5.0 | ||
*/ | ||
#ifndef LWMEM_HDR_SYS_H | ||
#define LWMEM_HDR_SYS_H | ||
|
Oops, something went wrong.