I'm allocating space at a specific address using 

`mmap(...,PROT_WRITE | PROT_READ, MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED,...)`

But if I call something like `new char[large_number]` that array is created overlapping the previously allocated memory segment. So my question is what should I do to protect the memory segment I've tried to allocate earlier.

EDIT:
For the following code,

```
char* base_address = (char*)malloc(sizeof(long));
int page_size = getpagesize();
size_t length = page_size;
char* selected_address = (char*)base_address + (page_size - ((long)base_address % page_size));

char* allocated_address = (char*) mmap(selected_address, page_size * 4, PROT_WRITE | PROT_READ
    ,  MAP_SHARED | MAP_ANONYMOUS | MAP_FIXED, -1, 0);

int* a = new int[page_size / 4];
// mprotect(allocated_address, page_size * 4, PROT_READ | PROT_WRITE);
int* b = new (allocated_address) int[page_size / 2];
int* c = new (allocated_address + page_size / 2 ) int[page_size/2];

int* d = (int*)malloc(page_size);

cout << "base_address:" << (int*)base_address << " selected_address:" << (int*)selected_address << " allocated_address:" << (int*)allocated_address << endl;
cout << "a=" << a << " end=" << &a[page_size/4 - 1] << endl;
cout << "b=" << b << " end=" << &b[page_size/2 - 1] << endl;
cout << "c=" << c << " end=" << &c[page_size/2 - 1] << endl;
cout << "d=" << d << " end=" << &d[page_size - 1] << endl;

```

I'm getting 

```
base_address:0x603010 selected_address:0x604000 allocated_address:0x604000
a=0x603030 end=0x60402c
b=0x604000 end=0x605ffc
c=0x604800 end=0x6067fc
d=0x604040 end=0x60803c

```

Shouldn't the a and d segments allocated outside of the mmap allocated space?