-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest034.cc
More file actions
85 lines (78 loc) · 4.33 KB
/
test034.cc
File metadata and controls
85 lines (78 loc) · 4.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include "dmalloc.hh"
#include <cstdio>
#include <cassert>
#include <cstring>
// Exercise large numbers of allocation sites.
const char* files[200] = {
"unprovoked.cc", "perissodactylate.cc", "makhzan.cc", "Janthinidae.cc",
"allothigenetic.cc", "taller.cc", "salmis.cc", "fortuity.cc",
"monarchically.cc", "cringe.cc", "wolfen.cc", "seem.cc", "pneumological.cc",
"Mysis.cc", "tumulus.cc", "rhombohedral.cc", "Gold.cc", "nosographical.cc",
"choice.cc", "quinible.cc", "reintuitive.cc", "unprimed.cc", "hexapla.cc",
"Salish.cc", "lush.cc", "ignifuge.cc", "bemercy.cc", "Bolelia.cc",
"thoracobronchotomy.cc", "viewster.cc", "assumption.cc", "travail.cc",
"progospel.cc", "undropsical.cc", "forjesket.cc", "astrolithology.cc",
"rooklet.cc", "animalcule.cc", "pulpotomy.cc", "debullition.cc",
"intransferable.cc", "subterrestrial.cc", "dosimeter.cc",
"straightforwardness.cc", "unlaundered.cc", "ornamentalize.cc",
"creatorhood.cc", "urbify.cc", "willies.cc", "ergotic.cc", "demoralization.cc",
"unpermeable.cc", "sensuousness.cc", "acetation.cc", "scart.cc", "rubican.cc",
"wronged.cc", "deficience.cc", "libretti.cc", "Brownistic.cc", "zaratite.cc",
"applesauce.cc", "vetanda.cc", "Luganda.cc", "zoophysiology.cc",
"epiplectic.cc", "obstructer.cc", "birddom.cc", "cerebral.cc",
"Melonechinus.cc", "blennothorax.cc", "ramule.cc", "phenolate.cc",
"phytography.cc", "Esdras.cc", "incruental.cc", "archichlamydeous.cc",
"Marginella.cc", "foreconceive.cc", "passionful.cc", "analcimite.cc",
"dharma.cc", "scoleciasis.cc", "scentless.cc", "cliff.cc", "sprawly.cc",
"oleraceous.cc", "pentanedione.cc", "cendre.cc", "autoreinfusion.cc",
"ternize.cc", "supraclavicle.cc", "circumstance.cc", "diphtheritic.cc",
"Didache.cc", "preseminal.cc", "scoldable.cc", "cicisbeism.cc", "schapping.cc",
"anterior.cc", "ryme.cc", "turion.cc", "boattail.cc", "Artamidae.cc",
"healder.cc", "portside.cc", "domesticative.cc", "tempered.cc",
"vaticinate.cc", "Electra.cc", "nectarize.cc", "inturn.cc", "murgeon.cc",
"exhaustlessly.cc", "holoclastic.cc", "linkboy.cc", "moiety.cc",
"bletheration.cc", "chartometer.cc", "laughful.cc", "eccentrate.cc",
"erythrosinophile.cc", "immetricalness.cc", "tangently.cc", "Jeffersonia.cc",
"subphratry.cc", "dermatotome.cc", "footscald.cc", "myrialitre.cc",
"amiced.cc", "jaspilite.cc", "butyrolactone.cc", "Shiraz.cc", "misalter.cc",
"Teutonicism.cc", "ungroundable.cc", "phosphuria.cc", "salmonet.cc",
"resupinate.cc", "Edoni.cc", "jewel.cc", "mysteriosophy.cc", "tolunitrile.cc",
"Cantabri.cc", "schizognathous.cc", "apotypic.cc", "Chanca.cc",
"conversibility.cc", "ergastoplasmic.cc", "biweekly.cc", "Zuni.cc",
"lignitize.cc", "sharklike.cc", "Stercorariidae.cc", "angiology.cc",
"Ostyak.cc", "Pakhpuluk.cc", "nocake.cc", "Pullman.cc", "orb.cc", "yardland.cc",
"Bahmani.cc", "stagnation.cc", "hidling.cc", "seasickness.cc", "underpan.cc",
"colophonium.cc", "underplan.cc", "extraparental.cc", "steatomatous.cc",
"rosette.cc", "circumspectively.cc", "Kevyn.cc", "adeem.cc", "eighthly.cc",
"laundryman.cc", "cellipetal.cc", "floorless.cc", "outthruster.cc",
"pawpaw.cc", "nubile.cc", "radiocaster.cc", "microcolorimetric.cc",
"unthrivingly.cc", "ribless.cc", "Phylloxeridae.cc", "Housatonic.cc",
"rebegin.cc", "queenship.cc", "pobby.cc", "deconcentrate.cc",
"Gasteromycetes.cc", "prebestow.cc", "printableness.cc", "photozincotypy.cc",
"unamenable.cc", "fawnery.cc", "radiodetector.cc", "hemoclasis.cc",
"epepophysis.cc"
};
int main() {
// array of pointers
const int nptrs = 200;
void* ptrs[nptrs];
for (int i = 0; i != nptrs; ++i) {
ptrs[i] = nullptr;
}
// do 1M allocations from different apparent allocation sites
for (unsigned i = 0; i != 500000; ++i) {
const char* file = files[random() % 200];
int line = 1 + random() % 200;
void* ptr = dmalloc_malloc(1 + random() % 128, file, line);
int slot = random() % nptrs;
dmalloc_free(ptrs[slot], file, line + 3);
ptrs[slot] = ptr;
}
for (int i = 0; i != nptrs; ++i) {
free(ptrs[i]);
}
dmalloc_print_statistics();
}
//!!TIME
//! alloc count: active 0 total 500000 fail 0
//! alloc size: active 0 total ??? fail ???