source: proiecte/swift/trunk/lib/hoard-371/src/heaplayers/sbrkheap.h @ 176

Last change on this file since 176 was 176, checked in by (none), 14 years ago
  • imported repo from "guagal"
File size: 674 bytes
Line 
1/* -*- C++ -*- */
2
3#ifndef _SBRKHEAP_H_
4#define _SBRKHEAP_H_
5
6#ifdef WIN32
7
8// If we're using Windows, we'll need to link in sbrk.c,
9// a replacement for sbrk().
10
11extern "C" void * sbrk (size_t sz);
12
13#endif
14
15/*
16 * @class SbrkHeap
17 * @brief A source heap that is a thin wrapper over sbrk.
18 *
19 * As it stands, memory cannot be returned to sbrk().
20 * This is not a significant limitation, since only memory
21 * at the end of the break point can ever be returned anyway.
22 */
23
24class SbrkHeap {
25public:
26  SbrkHeap (void)
27  {}
28
29  inline void * malloc (size_t sz) {
30    return sbrk(sz);
31  }
32 
33  inline void free (void *) { }
34  inline int remove (void *) { return 0; }
35};
36
37
38
39#endif
40
Note: See TracBrowser for help on using the repository browser.