34

I am looking for a lean and well constructed open source implementation of a B-tree library written in C. It needs to be under a non-GPL license so that it can be used in a commercial application. Ideally, this library supports the B-tree index to be stored/manipulated as a disk file so that large trees can be built using a configurable (ie: minimal) RAM footprint.

Note: Since there seemed to be some confusion, a Binary Tree and a B-Tree are not the same thing.

6 Answers 6

8

The author of the SQLite implementation has disclaimed copyright. If LGPL is okay, then maybe you could use GNUpdate's implementation?

1
  • the GNUpdate one is a B+Tree Dec 31, 2013 at 10:46
6

Check out QDBM: http://fallabs.com/qdbm/. It's LGPL (can be used in commercial app), implements a disk backed hash and/or B+ tree with arbitrary key/value pairs, and builds on a variety of platforms.

2
  • Nice! - This is a good addition to the list. Thanks!
    – Tall Jeff
    Mar 15, 2012 at 17:55
  • On second thought, I think this should also be the preferred answer.
    – Tall Jeff
    Mar 15, 2012 at 17:57
6

If LGPL is ok, then Tokyo Cabinet might fit the bill. LGPL allows linking with a non-Free application, without adding any constraints on the distribution of the final product.

2
  • It seems to have moved to fallabs.com/tokyocabinet .
    – florin
    Jan 27, 2012 at 15:42
  • Kyoto Cabinet is a GPL follow up to Tokyo Cabinet but after using it a for a while it has some very bad habits, for example no exception handling so on std::bad_alloc the app crashs or undefined and unconstraint memory usage patterns.
    – Lothar
    May 16, 2014 at 13:10
3

Attractive Chaos implement kbtree.h. It's a efficient B-tree library

2

I came across this - The WB B-Tree Database for SCM, Java, C#, and C that's a GNU package.

0

Maybe you can considere the berkeley db. It is using a b-tree internally.

Not the answer you're looking for? Browse other questions tagged or ask your own question.