[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["Dirk Pohl [EIT]" <pohl@rhrk.uni-kl.de>] (fwd)



>From owner-rtl Wed May 16 04:41:01 2001
Received: from sun.rhrk.uni-kl.de (sun.rhrk.uni-kl.de [131.246.137.50])
	by hq.fsmlabs.com (8.11.2/8.11.2) with SMTP id f4GAf0r05649
	for <rtl@rtlinux.org>; Wed, 16 May 2001 04:41:00 -0600
Received: from aixs1.rhrk.uni-kl.de
           ( exim@aixs1.rhrk.uni-kl.de [131.246.137.3] ) by sun.rhrk.uni-kl.de
          id aa11842 for <rtl@rtlinux.org>; 16 May 2001 12:36 MESZ
Received: from aixd1.rhrk.uni-kl.de ([131.246.137.210] ident=exim)
	by aixs1.rhrk.uni-kl.de with esmtp (Exim 3.03 #2)
	id 14zyfA-0006pq-00
	for rtl@rtlinux.org; Wed, 16 May 2001 12:36:16 +0200
Received: from pohl (helo=localhost)
	by aixd1.rhrk.uni-kl.de with local-esmtp (Exim 3.03 #5)
	id 14zyf8-00152a-00
	for rtl@rtlinux.org; Wed, 16 May 2001 12:36:14 +0200
Date: Wed, 16 May 2001 12:36:14 +0200 (MES)
From: "Dirk Pohl [EIT]" <pohl@rhrk.uni-kl.de>
To: RTLinux Mail <rtl@rtlinux.org>
Subject: Clarification wanted on dyn. mem. alloc. /new/delete (C++)
Message-ID: <Pine.A41.4.21.0105161121480.128938-100000@aixd1.rhrk.uni-kl.de>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII

I'm using RTLinux V3.0 with the rtl_cpp.o module.
Since I'm new to realtime programming, maybe I slightly missed the point
in the last C++ / dynamic memory allocation thread:
Some of you wrote that dynamic memory allocation (which is what new/delete
does, isn't it?!) is inherently evil ( :-) ) in a real time program or a
sign of a bad design. 
Now: Do you reject dynamic memory allocation in a real time program
because it may jeopardize the timing (e.g. when an allocation fails)?

The other way round: I want to use new/delete in a FIFO-Handler (as I said
under RTLinx V3.0) to create objects with new. In turn, these objects
create arrays with new. BUT THIS ALL HAPPENS BEFORE ANY REALTIME THREAD
STARTS, SO NO TIMING PROBLEMS MAY ARISE FROM THIS!
So if an allocation fails or lasts longer, nothing is lost, isn't it?!
After the objects are created with new, the realtime-thread starts and no
more new's are used. The thread then simply calls the memberfunctions.
Do I have to fear any consequences?
(You see, all I want from you is the assurance: Yes, if you do it that
way, you can dynamically create your objects and after that use them like
static variables. Without fear that the dynamic allocation of the objects
later wreaks havoc on your real time program.)

Thanks in advance
Dirk Pohl
University of Kaiserslautern