Click here to Skip to main content
15,914,488 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole7-Nov-11 7:22
Chuck O'Toole7-Nov-11 7:22 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 7:23
professionalAlbert Holguin7-Nov-11 7:23 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 7:41
Erudite_Eric7-Nov-11 7:41 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 7:45
professionalAlbert Holguin7-Nov-11 7:45 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 8:05
Erudite_Eric7-Nov-11 8:05 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 8:24
professionalAlbert Holguin7-Nov-11 8:24 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 20:57
Erudite_Eric7-Nov-11 20:57 
AnswerRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole8-Nov-11 2:04
Chuck O'Toole8-Nov-11 2:04 
As much as I hate jumping into another man's argument, I feel compelled to answer this one.
Quote:
When you have as much experience as me in the kernel I might listen to you
The problem with saying things like this is that somebody comes along with more experience. I'll see your 14 years and raise you 31 more. I've been doing this since 1967 on various machine types, mostly on kernel / monitor / core / OS, whatever you wish to call it. And yes, some of my kernel code has been into space.

Allocating from something called heap / common storage / pool / whatever is always slower than just adding / subtracting a size from the stack pointer. Plus, the pool is usually one shared resource so for multithreaded or multiprocessor kernels some sort of locking mechanism is needed to prevent corruption of the basic allocation / deallocation structures. Add in the possibility of doing allocations at interrupt level too and you complicate the locking mechanism further.

I've also dome a fair amount of kernel performance analysis over the years and guess what it reveals as a common bottleneck in kernel programming, heap allocation / deallocation. These are places where one would concentrate the efforts to find smarter and faster allocation methods, split poole, etc. And even though better algorithms have developed over the years, carving small arrays / structures / blocks of code on the stack just flys over calling pool allocation.

Now it is true that you need kernel pool for longer life objects and maybe for things too large to be of practical use on the stack but please don't argue that all things must always go on one place over another, that's just too many absolutes. Sounds more like a religious argument then a logical one.
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric8-Nov-11 22:02
Erudite_Eric8-Nov-11 22:02 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin9-Nov-11 4:03
professionalAlbert Holguin9-Nov-11 4:03 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole9-Nov-11 4:16
Chuck O'Toole9-Nov-11 4:16 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric9-Nov-11 22:50
Erudite_Eric9-Nov-11 22:50 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin10-Nov-11 11:51
professionalAlbert Holguin10-Nov-11 11:51 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric9-Nov-11 22:50
Erudite_Eric9-Nov-11 22:50 
AnswerRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole9-Nov-11 4:15
Chuck O'Toole9-Nov-11 4:15 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric9-Nov-11 22:54
Erudite_Eric9-Nov-11 22:54 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin8-Nov-11 2:48
professionalAlbert Holguin8-Nov-11 2:48 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric8-Nov-11 22:04
Erudite_Eric8-Nov-11 22:04 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
User 5838527-Nov-11 15:53
User 5838527-Nov-11 15:53 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 20:53
Erudite_Eric7-Nov-11 20:53 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
User 5838527-Nov-11 21:14
User 5838527-Nov-11 21:14 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin8-Nov-11 2:51
professionalAlbert Holguin8-Nov-11 2:51 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 7:45
Erudite_Eric7-Nov-11 7:45 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 7:47
professionalAlbert Holguin7-Nov-11 7:47 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 8:10
Erudite_Eric7-Nov-11 8:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.