从固定大小的缓冲区执行的malloc [英] malloc implementation from fixed size buffer

查看:343
本文介绍了从固定大小的缓冲区执行的malloc的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用一个大的固定大小的缓冲区一个通用的malloc实现。一些类似零的malloc内存分配器的SQLite了。你知道任何这样的实现?它应该是可用于嵌入式应用重量轻,便于携带。

I need a generic malloc implementation that uses one big fixed-size buffer. Something similar to the "Zero-malloc memory allocator" SQLite has. Do you know of any such implementations? It should be light-weight and portable that can be used for embedded applications.

先谢谢了。

推荐答案

两点建议:


  1. 如果你需要什么东西生产质量和行之有效的,只是借用的SQLite的分配器。 SQLite的源$ C ​​$ C是非常写得很好,记录非常好测试,有一个非常宽松的开源许可。

  2. 如果您需要一些小而简单,无论是学习还是在嵌入式环境中使用,考虑的这个实现 [无耻插件!] - 仅有350 LOC评价C $ C $的C

  1. IF you need something production quality and well tested, just borrow SQLite's allocator. SQLite's source code is very well-written, documented, extremely well-tested and has a very permissive open-source license.
  2. IF you need something small and simple, either to learn or to use in an embedded environment, consider this implementation [shameless plug!] - just 350 LOC of commented C code.

这篇关于从固定大小的缓冲区执行的malloc的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆