Sha256: 2a092afe9bf42666b85d3a6ec3a76efd0dc83259e50ad05ac9c30d6ccf1c9cb3
Contents?: true
Size: 673 Bytes
Versions: 1
Compression:
Stored size: 673 Bytes
Contents
#include <cstdio> #include <cstdlib> #include <vector> static constexpr size_t kMinAllocSz = 800000; static constexpr size_t kMaxAllocSz = 900000; static constexpr unsigned kMaxLiveAlloc = 128; // keep no more than 128 * kMaxAllocSz memory allocated. int main(void) { std::vector<void *> alloc(kMaxLiveAlloc, nullptr); for (size_t i = 0; i < kMaxLiveAlloc; i++) { if (alloc[i] != nullptr) { fprintf(stderr, "alloc not zero initialized!\n"); } } while (1) { const size_t ix = rand() % kMaxLiveAlloc; const size_t sz = (rand() % (kMaxAllocSz - kMinAllocSz)) + kMinAllocSz; free(alloc[ix]); alloc[ix] = malloc(sz); } return 0; }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mesh-rb-0.0.1 | ext/mesh/mesh/src/testing/global-large-stress.cc |