~ Akos.
--
Akos Polster
http://tftfy.blogspot.com/
> --
> Jansson users mailing list
> jansso...@googlegroups.com
> http://groups.google.com/group/jansson-users
Jansson relies heavily on malloc() and free() to manage its memory. It
uses very little stack space or static variables, almost everything
happens in heap.
It could be possible to overcome this by using custom memory
allocation functions, see
http://www.digip.org/jansson/doc/2.2/apiref.html#custom-memory-allocation
For example, you could reserve a static buffer and return chunks of
memory from that buffer. It would possibly be quite hard to get it
right, though, and you'd have to deal with fragmentation, etc.
Another solution would be to use some allocator library for embedded
systems. See the link above for examples on how to use a custom
allocator library.
Petri
As far as storing objects in non-volatile memory, you need to encode
Jansson objects back into JSON strings before saving them. You cannot
simply save out Jansson objects as they include function pointers and
other non-data members.
Hope this helps!
~Max
Sent from my private jet
--
Jansson's JSON decoder always parses the whole input to memory, so you
cannot read step-by-step. "yajl" is a widely used streaming JSON
library, see http://lloyd.github.com/yajl/