• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdecore
 

tdecore

  • tdecore
kallocator.h
1 /*
2  This file is part of the KDE libraries
3 
4  Copyright (C) 1999 Waldo Bastian (bastian@kde.org)
5  Copyright (C) 2002 Michael Matz (matz@kde.org)
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 //----------------------------------------------------------------------------
23 //
24 // KDE Memory Allocator
25 
26 #ifndef KALLOCATOR_H
27 #define KALLOCATOR_H
28 
29 #include <tqvaluelist.h>
30 #include "tdelibs_export.h"
31 
32 class TDEZoneAllocatorPrivate;
33 
34 
46 class TDECORE_EXPORT TDEZoneAllocator
47 {
48 public:
53  TDEZoneAllocator(unsigned long _blockSize = 8*1024);
54 
58  ~TDEZoneAllocator();
59 
65  void* allocate(size_t _size);
66 
87  void deallocate(void *ptr);
88 
109  void free_since(void *ptr);
110 
111 protected:
113  class MemBlock;
115  typedef TQValueList<MemBlock *> MemList;
116  void addBlock(MemBlock *b);
117  void delBlock(MemBlock *b);
118  void insertHash(MemBlock *b);
119  void initHash();
121  MemBlock *currentBlock;
123  unsigned long blockSize;
125  unsigned long blockOffset;
127  unsigned int log2;
129  unsigned int num_blocks;
131  MemList **hashList;
133  unsigned int hashSize;
135  bool hashDirty;
136 private:
137  TDEZoneAllocatorPrivate *d;
138 };
139 
140 #endif
TDEZoneAllocator
Memory allocator for large groups of small objects.
Definition: kallocator.h:47
TDEZoneAllocator::log2
unsigned int log2
base-2 log of the block size.
Definition: kallocator.h:127
TDEZoneAllocator::hashList
MemList ** hashList
Collection of lists of blocks, for lookups.
Definition: kallocator.h:131
TDEZoneAllocator::blockSize
unsigned long blockSize
Store block size from constructor.
Definition: kallocator.h:123
TDEZoneAllocator::num_blocks
unsigned int num_blocks
Count total number of allocated blocks.
Definition: kallocator.h:129
TDEZoneAllocator::blockOffset
unsigned long blockOffset
Store offset into current block; size-offset is free.
Definition: kallocator.h:125
TDEZoneAllocator::currentBlock
MemBlock * currentBlock
One block is 'current' to satisfy requests.
Definition: kallocator.h:121
TDEZoneAllocator::hashDirty
bool hashDirty
Flag the hashes as in need of reorganization.
Definition: kallocator.h:135
TDEZoneAllocator::hashSize
unsigned int hashSize
Count of hashes.
Definition: kallocator.h:133
TDEZoneAllocator::MemList
TQValueList< MemBlock * > MemList
A list of chunks.
Definition: kallocator.h:113

tdecore

Skip menu "tdecore"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdecore

Skip menu "tdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdecore by doxygen 1.9.1
This website is maintained by Timothy Pearson.