From: Jan Kiszka <kiszka@domain.hid>
To: Brandt Erickson <brandt@domain.hid>
Cc: xenomai@xenomai.org
Subject: Re: [Xenomai-help] native heap services and overloading new
Date: Wed, 02 Aug 2006 21:09:42 +0200 [thread overview]
Message-ID: <44D0F876.8020406@domain.hid> (raw)
In-Reply-To: <38215.155.98.4.39.1154456700.squirrel@domain.hid>
[-- Attachment #1: Type: text/plain, Size: 1038 bytes --]
Brandt Erickson wrote:
> I have some code where I'd like to be able to dynamically allocate memory
> in realtime. Since the code is written in C++, I was thinking of just
> making a huge global RT_HEAP and overloading the new and delete operators
> to use the rt_heap_alloc and rt_heap_free functions. First off, I'm
> wondering if there are any caveats to this sort of thing that wouldn't be
> obvious to someone new to xenomai like myself. Second, if I fail to call
> rt_heap_delete before the program terminates, does the heap remain
> registered hang potentially causing problems when I try to re-allocate the
> heap when the program is run again? Thanks.
For now: yes, the heap will stay, no automatic cleanup (the posix skin
already have this). You could then run into naming conflicts and you
lose memory, of course.
But you could install some signal handler for cleaning up. We do so in
our native-skin-based framework (also C++, but no "evil" ;) features in
use). We even catch SIGSEGV this way.
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 250 bytes --]
next prev parent reply other threads:[~2006-08-02 19:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-01 18:25 [Xenomai-help] native heap services and overloading new Brandt Erickson
2006-08-02 19:09 ` Jan Kiszka [this message]
2006-08-03 17:13 ` Philippe Gerum
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44D0F876.8020406@domain.hid \
--to=kiszka@domain.hid \
--cc=brandt@domain.hid \
--cc=xenomai@xenomai.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.