Changeset View
Changeset View
Standalone View
Standalone View
test/scudo/malloc.cpp
// RUN: %clangxx_scudo %s -lstdc++ -o %t | // RUN: %clangxx_scudo %s -lstdc++ -o %t | ||||
// RUN: %run %t 2>&1 | // RUN: %run %t 2>&1 | ||||
// Tests that a regular workflow of allocation, memory fill and free works as | // Tests that a regular workflow of allocation, memory fill and free works as | ||||
// intended. Tests various sizes serviced by the primary and secondary | // intended. Tests various sizes serviced by the primary and secondary | ||||
// allocators. | // allocators. | ||||
#include <assert.h> | #include <assert.h> | ||||
#include <stdlib.h> | #include <stdlib.h> | ||||
#include <string.h> | #include <string.h> | ||||
#include <vector> | #include <vector> | ||||
#if defined(_MSC_VER) | |||||
#include <BaseTsd.h> | |||||
typedef SSIZE_T ssize_t; | |||||
#endif | |||||
int main(int argc, char **argv) | int main(int argc, char **argv) | ||||
{ | { | ||||
void *p; | void *p; | ||||
std::vector<ssize_t> sizes{1, 8, 16, 32, 1024, 32768, | std::vector<ssize_t> sizes{1, 8, 16, 32, 1024, 32768, | ||||
1 << 16, 1 << 17, 1 << 20, 1 << 24}; | 1 << 16, 1 << 17, 1 << 20, 1 << 24}; | ||||
std::vector<int> offsets{1, 0, -1, -7, -8, -15, -16, -31, -32}; | std::vector<int> offsets{1, 0, -1, -7, -8, -15, -16, -31, -32}; | ||||
p = malloc(0); | p = malloc(0); | ||||
Show All 16 Lines |