site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com On Tuesday, April 12, 2005, at 04:45PM, Carl Smith <CSmith@fortresstech.com> wrote:
OK let me try it another way.
I have this structure declared as global: Struct Frame_Data { void *buff1; void *buff2; void *buff3; }
Then I declare as a global:
Int g_Array_Cnt = 0;
struct Frame_Data my_data[50];
So in my kernel's init routine I do:
While(g_Array_Cnt < 50) { if((my_data[g_Array_Cnt].buff1 = _MALLOC(1600, M_TEMP, M_WAITOK)) != 0) { bzero(&my_data[g_Array_Cnt].buff1, 1600);
if((my_data[g_Array_Cnt].buff2 = _MALLOC(1600, M_TEMP, M_WAITOK)) != 0) { bzero(&my_data[g_Array_Cnt].buff2, 1600);
if((my_data[g_Array_Cnt].buff3 = _MALLOC(1600, M_TEMP, M_WAITOK)) != 0) { bzero(&my_data[g_Array_Cnt].buff3, 1600); } else // error handling } else // error handling } else // error handling
g_Array_Cnt++; }
I'm frankly amazed this takes as long as it does to start behaving strangely. You want to be doing: bzero(my_data[g_Array_cnt].buff2); Notice, NO AMPERSAND. Currently you're wiping out 1600 bytes of data space every time you bzero something, not clearing the buffer you just allocated... William Kucharski kucharsk@mac.com _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
William Kucharski