npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wlib-tlsf

v1.0.5

Published

TLSF memory allocator

Downloads

21

Readme

WLib TLSF

Two-level segregated-fit memory allocator package for WLib. Allocator created by Matthew Conte.

Modified API for WLib.

API Usage

The documentation is a little lacking on initialization but you essentially pass a memory pool for TLSF to manage.

enum { STATIC_POOL_SIZE = 1 << 20 };
static char s_pool[STATIC_POOL_SIZE];

tlsf_t instance = tlsf_create_with_pool(s_pool, STATIC_POOL_SIZE);

void *data = tlsf_malloc(instance, 64);
tlsf_free(instance, data);

Configuration

Three main flags are used to control the operation of the TLSF.

WLIB_TLSF_LOG2_DIV

Log of the number of subdivisions within a size class. Larger values introduce more overhead to the TLSF structure but reduce fragmentation. Values should be at least 2. Typical values up to 5.

WLIB_TLSF_LOG2_ALIGN

Log of the alignment of memory and blocks. E.g. a value of 2 aligns to 4 bytes. The alignment must be at least the architecture alignment; that is, 2 bytes for 16-bit, 4 bytes for 32-bit, and 8 bytes for 64-bit.

Larger values may be used to align to page boundaries.

WLIB_TLSF_LOG2_MAX

Log of the maximum possible allocation size. This value directly affects the maximum pool size that can be managed by TLSF. Increasing it, however, will increase overhead.

Specify Architecture

One of WLIB_TLSF_16BIT, WLIB_TLSF_32BIT, or WLIB_TLSF_64BIT must be specified to select the architecture. TLSF attempts to dectect the specific architecture to use builtins, but these can be specified as

  • WLIB_TLSF_ARM
  • WLIB_TLSF_GHS
  • WLIB_TLSF_GNU
  • WLIB_TLSF_MSC
  • WLIB_TLSF_PPC
  • WLIB_TLSF_SNC

If none is specified or autodetection fails, TLSF falls back to a generic implementation of CLZ.

Debugging

The flag WLIB_TLSF_DEBUG_LEVEL specifies the amount of printing and run-time assertions. A value of 0 turns all off, a value of 1 will print errors and run asserts, and a value of 2 will print some verbose output.

Custom assert and print handlers can be implemented by defining WLIB_TLSF_ASSERT and WLIB_TLSF_PRINTF and then providing the functions

void tlsf_printf(const char *fmt, ...) 
{ /* ... */ }

void tlsf_assert(bool expr, const char *msg)
{ /* ... */ }

Usage on AVR

Recommended settings are

pkg_compile_flags:
- -DWLIB_TLSF_16BIT
- -DWLIB_TLSF_LOG2_DIV=2
- -DWLIB_TLSF_LOG2_ALIGN=1
- -DWLIB_TLSF_LOG2_MAX=10
- -DWLIB_TLSF_PRINTF
- -DWLIB_TLSF_ASSERT

For boards will limited RAM.