# wlib-malloc

> Replacements for malloc and free

Latest version **1.0.4** (published 2018-09-29) · 0 weekly downloads

## Install

```sh
npm install wlib-malloc
pnpm add wlib-malloc
yarn add wlib-malloc
bun add wlib-malloc
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2018-09-29 |
| First published | 2018-06-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jeff Niu <jeffniu22@gmail.com> (https://github.com/mogball) |
| Maintainers | mogball |
| Keywords | wio, c, c++, memory, embedded, waterloop |

## Links

- npm: https://www.npmjs.com/package/wlib-malloc
- Repository: https://github.com/wloop/wlib-malloc.git
- npm.io page: https://npm.io/package/wlib-malloc

## Dependencies (1)

- [wlib-tlsf](https://npm.io/package/wlib-tlsf.md) 1.0.5

## Alternatives

- [@gemini-wallet/core](https://npm.io/package/@gemini-wallet/core.md) — 515.6K weekly downloads
- [utility](https://npm.io/package/utility.md) — 416.6K weekly downloads
- [@primno/dpapi](https://npm.io/package/@primno/dpapi.md) — 7.2K weekly downloads
- [pi-readseek](https://npm.io/package/pi-readseek.md) — 3.7K weekly downloads
- [@emilia-protocol/verify](https://npm.io/package/@emilia-protocol/verify.md) — 1.1K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2018-09-29
- 1.0.3 — 2018-09-29
- 1.0.2 — 2018-09-25
- 1.0.1 — 2018-06-15
- 1.0.0 — 2018-06-15

## README

# wlib-malloc

`malloc` and `free` replacements for WLib using `wlib-tlsf`.

### Install

```bash
wio pac add wlib-malloc
```

### Usage

`mem::meminit` must be called at program start with a user-provided memory pool
for the global allocator instance to manage.

```c++
static byte s_pool[POOL_SIZE];

using namespace wlp;

int main(int argc, char *argv[]) {
    mem::init(s_pool, POOL_SIZE);
    
    char *ptr = static_cast<char *>(mem::alloc(128));
    // ...
    mem::free(ptr);
}

```

---
_Source: https://npm.io/package/wlib-malloc · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
