Click here to Skip to main content
15,850,685 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 8:22
Chuck O'Toole7-Nov-11 8:22 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 8:23
professionalAlbert Holguin7-Nov-11 8:23 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 8:41
Erudite_Eric7-Nov-11 8:41 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 8:45
professionalAlbert Holguin7-Nov-11 8:45 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 9:05
Erudite_Eric7-Nov-11 9:05 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 9:24
professionalAlbert Holguin7-Nov-11 9:24 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 21:57
Erudite_Eric7-Nov-11 21:57 
AnswerRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole8-Nov-11 3:04
Chuck O'Toole8-Nov-11 3: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 23:02
Erudite_Eric8-Nov-11 23:02 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin9-Nov-11 5:03
professionalAlbert Holguin9-Nov-11 5:03 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole9-Nov-11 5:16
Chuck O'Toole9-Nov-11 5:16 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric9-Nov-11 23:50
Erudite_Eric9-Nov-11 23:50 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin10-Nov-11 12:51
professionalAlbert Holguin10-Nov-11 12:51 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric9-Nov-11 23:50
Erudite_Eric9-Nov-11 23:50 
AnswerRe: making a unsigned char array gives a buffer overrun error Pin
Chuck O'Toole9-Nov-11 5:15
Chuck O'Toole9-Nov-11 5:15 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric9-Nov-11 23:54
Erudite_Eric9-Nov-11 23:54 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin8-Nov-11 3:48
professionalAlbert Holguin8-Nov-11 3:48 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric8-Nov-11 23:04
Erudite_Eric8-Nov-11 23:04 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
User 5838527-Nov-11 16:53
User 5838527-Nov-11 16:53 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 21:53
Erudite_Eric7-Nov-11 21:53 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
User 5838527-Nov-11 22:14
User 5838527-Nov-11 22:14 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin8-Nov-11 3:51
professionalAlbert Holguin8-Nov-11 3:51 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 8:45
Erudite_Eric7-Nov-11 8:45 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Albert Holguin7-Nov-11 8:47
professionalAlbert Holguin7-Nov-11 8:47 
GeneralRe: making a unsigned char array gives a buffer overrun error Pin
Erudite_Eric7-Nov-11 9:10
Erudite_Eric7-Nov-11 9: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.