diff options
author | Christopher Faylor <me@cgf.cx> | 2003-08-23 00:03:54 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-08-23 00:03:54 +0000 |
commit | 5c6497b43f67ac058e6699ebcd5f3961567ef13c (patch) | |
tree | 2b99de220729c9ae9a0d53cc98be0a62812ac423 | |
parent | 7f32ba3a8de4e8c74c7a97d4ee76b1b3a313b6ff (diff) | |
download | cygnal-5c6497b43f67ac058e6699ebcd5f3961567ef13c.tar.gz cygnal-5c6497b43f67ac058e6699ebcd5f3961567ef13c.tar.bz2 cygnal-5c6497b43f67ac058e6699ebcd5f3961567ef13c.zip |
* cygheap.h (enum cygheap_types): Add HEAP_MMAP.
(CYGHEAPSIZE): Add another 64K.
* mmap.cc: Use cmalloc, ccalloc and crealloc with HEAP_MMAP type throughout.
-rw-r--r-- | winsup/cygwin/ChangeLog | 7 | ||||
-rw-r--r-- | winsup/cygwin/cygheap.h | 5 | ||||
-rw-r--r-- | winsup/cygwin/mmap.cc | 18 |
3 files changed, 19 insertions, 11 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index e85e768b4..436f853a2 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,10 @@ +2003-08-22 Corinna Vinschen <corinna@vinschen.de> + + * cygheap.h (enum cygheap_types): Add HEAP_MMAP. + (CYGHEAPSIZE): Add another 64K. + * mmap.cc: Use cmalloc, ccalloc and crealloc with HEAP_MMAP type + throughout. + 2003-08-22 Christopher Faylor <cgf@redhat.com> * cygheap.cc (user_heap_info::max): New field. diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h index c03d60077..2211af2be 100644 --- a/winsup/cygwin/cygheap.h +++ b/winsup/cygwin/cygheap.h @@ -22,7 +22,8 @@ enum cygheap_types HEAP_1_ARGV, HEAP_1_BUF, HEAP_1_EXEC, - HEAP_1_MAX = 100 + HEAP_1_MAX = 100, + HEAP_MMAP = 200 }; #define incygheap(s) (cygheap && ((char *) (s) >= (char *) cygheap) && ((char *) (s) <= ((char *) cygheap_max))) @@ -256,7 +257,7 @@ struct init_cygheap #endif }; -#define CYGHEAPSIZE (sizeof (init_cygheap) + (16000 * sizeof (fhandler_union)) + (4 * 65536)) +#define CYGHEAPSIZE (sizeof (init_cygheap) + (16000 * sizeof (fhandler_union)) + (5 * 65536)) extern init_cygheap *cygheap; extern void *cygheap_max; diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 6af4946a7..f38568f94 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -76,7 +76,7 @@ class mmap_record caddr_t get_address () const { return base_address_; } DWORD *get_map () const { return map_map_; } void alloc_map (_off64_t off, DWORD len); - void free_map () { if (map_map_) free (map_map_); } + void free_map () { if (map_map_) cfree (map_map_); } DWORD find_empty (DWORD pages); _off64_t map_map (_off64_t off, DWORD len); @@ -113,8 +113,8 @@ void mmap_record::alloc_map (_off64_t off, DWORD len) { /* Allocate one bit per page */ - map_map_ = (DWORD *) calloc (MAPSIZE (PAGE_CNT (size_to_map_)), - sizeof (DWORD)); + map_map_ = (DWORD *) ccalloc (HEAP_MMAP, MAPSIZE (PAGE_CNT (size_to_map_)), + sizeof (DWORD)); if (wincap.virtual_protect_works_on_shared_pages ()) { DWORD old_prot; @@ -277,14 +277,14 @@ public: list::list () : nrecs (0), maxrecs (10), fd (0), hash (0) { - recs = (mmap_record *) malloc (10 * sizeof (mmap_record)); + recs = (mmap_record *) cmalloc (HEAP_MMAP, 10 * sizeof (mmap_record)); } list::~list () { for (mmap_record *rec = recs; nrecs-- > 0; ++rec) rec->free_map (); - free (recs); + cfree (recs); } mmap_record * @@ -293,7 +293,7 @@ list::add_record (mmap_record r, _off64_t off, DWORD len) if (nrecs == maxrecs) { maxrecs += 5; - recs = (mmap_record *) realloc (recs, maxrecs * sizeof (mmap_record)); + recs = (mmap_record *) crealloc (recs, maxrecs * sizeof (mmap_record)); } recs[nrecs] = r; recs[nrecs].alloc_map (off, len); @@ -373,14 +373,14 @@ public: map::map () { - lists = (list **) malloc (10 * sizeof (list *)); + lists = (list **) cmalloc (HEAP_MMAP, 10 * sizeof (list *)); nlists = 0; maxlists = 10; } map::~map () { - free (lists); + cfree (lists); } list * @@ -408,7 +408,7 @@ map::add_list (list *l, int fd) if (nlists == maxlists) { maxlists += 5; - lists = (list **) realloc (lists, maxlists * sizeof (list *)); + lists = (list **) crealloc (lists, maxlists * sizeof (list *)); } lists[nlists++] = l; return lists[nlists-1]; |