]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/moe/server/src/slab_alloc.h
Inital import
[l4.git] / l4 / pkg / moe / server / src / slab_alloc.h
1 /*
2  * (c) 2008-2009 Technische Universität Dresden
3  * This file is part of TUD:OS and distributed under the terms of the
4  * GNU General Public License 2.
5  * Please see the COPYING-GPL-2 file for details.
6  */
7 #pragma once
8
9 #include <gc.h>
10
11
12 template< typename T >
13 struct Slab_alloc
14 {
15   T *alloc()
16   {
17     T *t =(T*)GC_MALLOC(sizeof(T));
18     if (!t) throw L4::Out_of_memory();
19     return t;
20   }
21   void free(void*) {}
22
23 };