summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2001-04-13 12:26:02 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2001-04-13 12:26:02 +0000
commit9560ce25f1faa97709827d78c1314c2c6c5acde1 (patch)
tree66e0c8f786c7ac33181de7e24bd8d9bcf2c97b6a
parent15521b4ca7fec6a65aa6939e254e43f7b1386859 (diff)
downloadATCD-9560ce25f1faa97709827d78c1314c2c6c5acde1.tar.gz
ChangeLogTag:Fri Apr 13 05:30:04 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
-rw-r--r--ChangeLog9
-rw-r--r--ChangeLogs/ChangeLog-02a9
-rw-r--r--ChangeLogs/ChangeLog-03a9
-rw-r--r--THANKS1
-rw-r--r--ace/Malloc.h1
-rw-r--r--ace/Malloc_Allocator.h22
-rw-r--r--ace/Malloc_Allocator.i22
-rw-r--r--ace/Malloc_T.h21
-rw-r--r--ace/Malloc_T.i23
-rw-r--r--ace/Reactor.h1
10 files changed, 93 insertions, 25 deletions
diff --git a/ChangeLog b/ChangeLog
index 7b73547a803..163db36a03b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
Fri Apr 13 05:30:04 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
+ * ace/Malloc_T.{h,i}: Added support for one of the calloc() methods
+ to ACE_Cached_Allocator. Thanks to Rachel G Smith
+ <Rachel_G_Smith@raytheon.com> for motivating this change.
+
+ * ace/Malloc_Allocator.h: Updated the comments for ACE_New_Allocator
+ to indicate that the calloc() methods are also supported.
+ Thanks to Rachel G Smith <Rachel_G_Smith@raytheon.com> for
+ motivating this change.
+
* docs/ACE-bug-process.html: Updated this document to explain how
bugs pertaining to OCI's TAO releases should be handled. Thanks
to Georg Lohrer <GeorgLohrer@web.de> for motivating this.
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 7b73547a803..163db36a03b 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,5 +1,14 @@
Fri Apr 13 05:30:04 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
+ * ace/Malloc_T.{h,i}: Added support for one of the calloc() methods
+ to ACE_Cached_Allocator. Thanks to Rachel G Smith
+ <Rachel_G_Smith@raytheon.com> for motivating this change.
+
+ * ace/Malloc_Allocator.h: Updated the comments for ACE_New_Allocator
+ to indicate that the calloc() methods are also supported.
+ Thanks to Rachel G Smith <Rachel_G_Smith@raytheon.com> for
+ motivating this change.
+
* docs/ACE-bug-process.html: Updated this document to explain how
bugs pertaining to OCI's TAO releases should be handled. Thanks
to Georg Lohrer <GeorgLohrer@web.de> for motivating this.
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 7b73547a803..163db36a03b 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,5 +1,14 @@
Fri Apr 13 05:30:04 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
+ * ace/Malloc_T.{h,i}: Added support for one of the calloc() methods
+ to ACE_Cached_Allocator. Thanks to Rachel G Smith
+ <Rachel_G_Smith@raytheon.com> for motivating this change.
+
+ * ace/Malloc_Allocator.h: Updated the comments for ACE_New_Allocator
+ to indicate that the calloc() methods are also supported.
+ Thanks to Rachel G Smith <Rachel_G_Smith@raytheon.com> for
+ motivating this change.
+
* docs/ACE-bug-process.html: Updated this document to explain how
bugs pertaining to OCI's TAO releases should be handled. Thanks
to Georg Lohrer <GeorgLohrer@web.de> for motivating this.
diff --git a/THANKS b/THANKS
index 9c6ea3c54ae..e4dbc58cdc7 100644
--- a/THANKS
+++ b/THANKS
@@ -1209,6 +1209,7 @@ Gunnar Buason <a98gunbu@student.his.se>
David Hanvey <d.hanvey@qub.ac.uk>
Jeff McNiel <Jeff_McNiel@VitalCom.com>
Georg Lohrer <GeorgLohrer@web.de>
+Rachel G Smith <Rachel_G_Smith@raytheon.com>
I would particularly like to thank Paul Stephenson, who worked with me
at Ericsson in the early 1990's. Paul devised the recursive Makefile
diff --git a/ace/Malloc.h b/ace/Malloc.h
index deec257078d..f36c60661e0 100644
--- a/ace/Malloc.h
+++ b/ace/Malloc.h
@@ -10,7 +10,6 @@
*/
//=============================================================================
-
#ifndef ACE_MALLOC_H
#define ACE_MALLOC_H
#include "ace/pre.h"
diff --git a/ace/Malloc_Allocator.h b/ace/Malloc_Allocator.h
index ad848c2966a..b932adb74f4 100644
--- a/ace/Malloc_Allocator.h
+++ b/ace/Malloc_Allocator.h
@@ -1,15 +1,15 @@
+/* -*- C++ -*- */
//=============================================================================
/**
* @file Malloc_Allocator.h
*
* $Id$
- *
+ *
* @author Priyanka Gontla <pgontla@ece.uci.edu>
*/
//=============================================================================
-
#ifndef MALLOC_ALLOCATOR_H
#define MALLOC_ALLOCATOR_H
#include "ace/pre.h"
@@ -60,21 +60,25 @@ struct ACE_Export ACE_Malloc_Stats
* @brief Defines a class that provided a simple implementation of
* memory allocation.
*
- * This class uses the new/delete operators to allocate and free
- * up memory. Please note that the only methods that are
- * supported are malloc and free. All other methods are no-ops.
- * If you require this functionality, please use:
- * ACE_Allocator_Adapter <ACE_Malloc <ACE_LOCAL_MEMORY_POOL,
- * MUTEX> > This will allow you to use the added functionality
- * of bind/find/etc. while using the new/delete operators.
+ * This class uses the new/delete operators to allocate and free up
+ * memory. Please note that the only methods that are supported are
+ * <malloc>, <calloc>, and <free>. All other methods are no-ops that
+ * return -1 and set <errno> to <ENOTSUP>. If you require this
+ * functionality, please use: ACE_Allocator_Adapter <ACE_Malloc
+ * <ACE_LOCAL_MEMORY_POOL, MUTEX> >, which will allow you to use the
+ * added functionality of bind/find/etc. while using the new/delete
+ * operators.
*/
class ACE_Export ACE_New_Allocator : public ACE_Allocator
{
public:
+ /// These methods are defined.
virtual void *malloc (size_t nbytes);
virtual void *calloc (size_t nbytes, char initial_value = '\0');
virtual void *calloc (size_t n_elem, size_t elem_size, char initial_value = '\0');
virtual void free (void *ptr);
+
+ /// These methods are no-ops.
virtual int remove (void);
virtual int bind (const char *name, void *pointer, int duplicates = 0);
virtual int trybind (const char *name, void *&pointer);
diff --git a/ace/Malloc_Allocator.i b/ace/Malloc_Allocator.i
index 045f4aec13b..b0cfd89b218 100644
--- a/ace/Malloc_Allocator.i
+++ b/ace/Malloc_Allocator.i
@@ -37,67 +37,67 @@ ACE_New_Allocator::free (void *ptr)
ACE_INLINE int
ACE_New_Allocator::remove (void)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::bind (const char *, void *, int)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::trybind (const char *, void *&)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::find (const char *, void *&)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::find (const char *)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::unbind (const char *)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::unbind (const char *, void *&)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::sync (ssize_t, int)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::sync (void *, size_t, int)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::protect (ssize_t, int)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
ACE_INLINE int
ACE_New_Allocator::protect (void *, size_t, int)
{
- return -1;
+ ACE_NOTSUP_RETURN (-1);
}
#if defined (ACE_HAS_MALLOC_STATS)
diff --git a/ace/Malloc_T.h b/ace/Malloc_T.h
index cb208f0ad16..5364a4d7acb 100644
--- a/ace/Malloc_T.h
+++ b/ace/Malloc_T.h
@@ -84,18 +84,33 @@ public:
~ACE_Cached_Allocator (void);
/**
- * Get a chunk of memory from free store. Note that <nbytes> is
+ * Get a chunk of memory from free list cache. Note that <nbytes> is
* only checked to make sure that it's <= to sizeof T, and is
* otherwise ignored since <malloc> always returns a pointer to an
* item of sizeof (T).
*/
void *malloc (size_t nbytes = sizeof (T));
- /// return a chunk of memory back to free store.
+ /**
+ * Get a chunk of memory from free list cache, giving them
+ * <initial_value>. Note that <nbytes> is only checked to make sure
+ * that it's <= to sizeof T, and is otherwise ignored since <malloc>
+ * always returns a pointer to an item of sizeof (T).
+ */
+ virtual void *calloc (size_t nbytes,
+ char initial_value = '\0');
+
+ /// This method is a no-op and just returns 0 since the free list
+ /// only works with fixed sized entities.
+ virtual void *calloc (size_t n_elem,
+ size_t elem_size,
+ char initial_value = '\0');
+
+ /// Return a chunk of memory back to free list cache.
void free (void *);
private:
- /// remember how we allocate the memory in the first place so
+ /// Remember how we allocate the memory in the first place so
/// we can clear things up later.
char *pool_;
diff --git a/ace/Malloc_T.i b/ace/Malloc_T.i
index 28c943ba08b..dbe502de44b 100644
--- a/ace/Malloc_T.i
+++ b/ace/Malloc_T.i
@@ -36,6 +36,29 @@ ACE_Cached_Allocator<T, ACE_LOCK>::malloc (size_t nbytes)
return this->free_list_.remove ()->addr ();
}
+template <class T, class ACE_LOCK> ACE_INLINE void *
+ACE_Cached_Allocator<T, ACE_LOCK>::calloc (size_t nbytes,
+ char initial_value)
+{
+ // Check if size requested fits within pre-determined size.
+ if (nbytes > sizeof (T))
+ return NULL;
+
+ // addr() call is really not absolutely necessary because of the way
+ // ACE_Cached_Mem_Pool_Node's internal structure arranged.
+ void *ptr = this->free_list_.remove ()->addr ();
+ ACE_OS::memset (ptr, initial_value, sizeof (T));
+ return ptr;
+}
+
+template <class T, class ACE_LOCK> ACE_INLINE void *
+ACE_Cached_Allocator<T, ACE_LOCK>::calloc (size_t,
+ size_t,
+ char)
+{
+ ACE_NOTSUP_RETURN (0);
+}
+
template <class T, class ACE_LOCK> ACE_INLINE void
ACE_Cached_Allocator<T, ACE_LOCK>::free (void * ptr)
{
diff --git a/ace/Reactor.h b/ace/Reactor.h
index a80c98b6289..038f5eef7bb 100644
--- a/ace/Reactor.h
+++ b/ace/Reactor.h
@@ -10,7 +10,6 @@
*/
//=============================================================================
-
#ifndef ACE_REACTOR_H
#define ACE_REACTOR_H
#include "ace/pre.h"