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

kdecore

  • kdecore
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 "kdelibs_export.h"
31 
32 class KZoneAllocatorPrivate;
33 
34 
46 class KDECORE_EXPORT KZoneAllocator
47 {
48 public:
53  KZoneAllocator(unsigned long _blockSize = 8*1024);
54 
58  ~KZoneAllocator();
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  KZoneAllocatorPrivate *d;
138 };
139 
140 #endif
KZoneAllocator::hashDirty
bool hashDirty
Flag the hashes as in need of reorganization.
Definition: kallocator.h:135
KZoneAllocator::log2
unsigned int log2
base-2 log of the block size.
Definition: kallocator.h:127
KZoneAllocator::currentBlock
MemBlock * currentBlock
One block is 'current' to satisfy requests.
Definition: kallocator.h:121
KZoneAllocator::num_blocks
unsigned int num_blocks
Count total number of allocated blocks.
Definition: kallocator.h:129
KZoneAllocator::blockSize
unsigned long blockSize
Store block size from constructor.
Definition: kallocator.h:123
KZoneAllocator
Memory allocator for large groups of small objects.
Definition: kallocator.h:46
KZoneAllocator::hashList
MemList ** hashList
Collection of lists of blocks, for lookups.
Definition: kallocator.h:131
KZoneAllocator::hashSize
unsigned int hashSize
Count of hashes.
Definition: kallocator.h:133
KZoneAllocator::MemList
TQValueList< MemBlock * > MemList
A list of chunks.
Definition: kallocator.h:113
KZoneAllocator::blockOffset
unsigned long blockOffset
Store offset into current block; size-offset is free.
Definition: kallocator.h:125

kdecore

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

kdecore

Skip menu "kdecore"
  • arts
  • dcop
  • dnssd
  • interfaces
  •     interface
  •     library
  •   kspeech
  •   ktexteditor
  • kabc
  • kate
  • kcmshell
  • kdecore
  • kded
  • kdefx
  • kdeprint
  • kdesu
  • kdeui
  • kdoctools
  • khtml
  • kimgio
  • kinit
  • kio
  •   bookmarks
  •   httpfilter
  •   kfile
  •   kio
  •   kioexec
  •   kpasswdserver
  •   kssl
  • kioslave
  •   http
  • kjs
  • kmdi
  •   kmdi
  • knewstuff
  • kparts
  • krandr
  • kresources
  • kspell2
  • kunittest
  • kutils
  • kwallet
  • libkmid
  • libkscreensaver
Generated for kdecore by doxygen 1.8.8
This website is maintained by Timothy Pearson.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. |