Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/tests/vmalloc/tsmall.c
1810 views
1
/***********************************************************************
2
* *
3
* This software is part of the ast package *
4
* Copyright (c) 1999-2011 AT&T Intellectual Property *
5
* and is licensed under the *
6
* Eclipse Public License, Version 1.0 *
7
* by AT&T Intellectual Property *
8
* *
9
* A copy of the License is available at *
10
* http://www.eclipse.org/org/documents/epl-v10.html *
11
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
12
* *
13
* Information and Software Systems Research *
14
* AT&T Research *
15
* Florham Park NJ *
16
* *
17
* Glenn Fowler <[email protected]> *
18
* *
19
***********************************************************************/
20
#include "vmtest.h"
21
22
tmain()
23
{
24
Vmalloc_t* vm;
25
Void_t* addr[10];
26
27
Vmdcheap->round = 64;
28
if(!(vm = vmopen(Vmdcheap, Vmbest, 0)) )
29
terror("Open failed");
30
31
if(!(addr[0] = vmalloc(vm, 8)) )
32
terror("vmalloc failed");
33
if(!(addr[1] = vmalloc(vm, 8)) )
34
terror("vmalloc failed");
35
if(!(addr[2] = vmalloc(vm, 8)) )
36
terror("vmalloc failed");
37
38
if(!(addr[3] = vmalloc(vm, 12)) )
39
terror("vmalloc failed");
40
if(!(addr[4] = vmalloc(vm, 12)) )
41
terror("vmalloc failed");
42
if(!(addr[5] = vmalloc(vm, 12)) )
43
terror("vmalloc failed");
44
45
if(vmfree(vm, addr[1]) < 0)
46
terror("vmfree failed");
47
if(vmdbcheck(vm) < 0)
48
terror("vmdbcheck failed");
49
50
if(vmfree(vm, addr[4]) < 0)
51
terror("vmfree failed");
52
vmdbcheck(vm);
53
54
if(vmcompact(vm) < 0)
55
terror("vmcompact failed");
56
if(vmdbcheck(vm) < 0)
57
terror("vmdbcheck failed");
58
59
texit(0);
60
}
61
62