Hello,

I am currently implementing part of 0mq for http://www.contiki-os.org/.
Contiki offers 3 memory allocation techniques (see here
<https://github.com/contiki-os/contiki/wiki/Memory-allocation#The_mmem_Managed_Memory_Allocator>
).

So far, I was able to use memb (sort of preallocation) most of the time.
But a couple times I still had to use traditional malloc.
I judge these use of malloc still OK as they are limited and short lived
(one for putting together a send buffer made of data coming from various
variables, and another one for message payload). I may need it as well to
store socket identity.
Contiki also have what they call memm which is sort of like malloc but
preallocated and defragmented. But its boiler plate seems a bit "invasive".
I might consider using it later.


About preallocation, one down side is to balance between preallocating
enough for a normal usage of zeromq sockets, and not preallocating to much
to avoid sucking up all the ram.

I think it is doable to not use malloc at all with a bit of extra effort.
But it might come at the cost of not being able to just copy/paste current
reference implementation to accommodate for all the necessary
modifications, and make zeromq a tad less memory "hungry" for a constrained
environment.


Cheers,
Axel

--
Contact: axel.voit...@gmail.com
Secure: axel.voit...@protonmail.ch

2016-01-18 13:37 GMT+01:00 Auer, Jens <jens.a...@cgi.com>:

> Hi,
>
> zeroMQ internally does dynamic allocations and there is no easy way to
> modify this from the code using the library. One example are the messages
> that get generated when receiving data.
>
> I was thinking about adding support for custom allocators to it, but have
> not proceeded further than some brainstorming. I think I know how to do it,
> but did not have the time to start with it.
>
> Best wishes,
>   Jens
>
> --
> Dr. Jens Auer | CGI | Software Engineer
> CGI Deutschland Ltd. & Co. KG
> Rheinstraße 95 | 64295 Darmstadt | Germany
> T: +49 6151 36860 154
> jens.a...@cgi.com
> Unsere Pflichtangaben gemäß § 35a GmbHG / §§ 161, 125a HGB finden Sie
> unter de.cgi.com/pflichtangaben.
>
> CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to
> CGI Group Inc. and its affiliates may be contained in this message. If you
> are not a recipient indicated or intended in this message (or responsible
> for delivery of this message to such person), or you think for any reason
> that this message may have been addressed to you in error, you may not use
> or copy or deliver this message to anyone else. In such case, you should
> destroy this message and are asked to notify the sender by reply e-mail.
>
> > -----Original Message-----
> > From: zeromq-dev-boun...@lists.zeromq.org [mailto:zeromq-dev-
> > boun...@lists.zeromq.org] On Behalf Of Greg Young
> > Sent: 17 January 2016 18:19
> > To: zeromq-dev@lists.zeromq.org
> > Subject: [zeromq-dev] Pre-Alloc only environments
> >
> > Has anyone ever tried using 0mq and many of the associated libraries in
> a pre-
> > allocation only environment? Where would I start looking down these
> roads? What
> > gotchas should I be looking out for?
> >
> > Cheers,
> >
> > Greg
> >
> > --
> > Studying for the Turing test
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev@lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev@lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to