Skip to content

adamfur/Palloc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palloc

C treats the memory as one continious array. Writing outside your boundary might, but probably won't alert you of any missconduct.

ptr = (char *) malloc(42);

*(ptr + 41) = '\0'; // OK: Last element in the memory region.
*(ptr + 42) = '\0'; // **BAD**: Outside allowed memory boundary. Silently corrupting memory!!!

However with palloc, allocation will yield a memory map, strictly followed by a nonwriteable region.

ptr = (char *) palloc(42);

*(ptr + 41) = '\0'; // OK: Last element in the memory region.
*(ptr + 42) = '\0'; // Will always SEGFAULT!

About

No description or website provided.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published