mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 04:19:21 +08:00
* cygheap.h (enum cygheap_types): Add HEAP_MMAP.
(CYGHEAPSIZE): Add another 64K. * mmap.cc: Use cmalloc, ccalloc and crealloc with HEAP_MMAP type throughout.
This commit is contained in:
parent
7f32ba3a8d
commit
5c6497b43f
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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];
|
||||
|
Loading…
x
Reference in New Issue
Block a user