• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: Kernel stack size
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Kernel stack size


  • Subject: RE: Kernel stack size
  • From: William Kucharski <email@hidden>
  • Date: Tue, 12 Apr 2005 16:53:34 -0600

On Tuesday, April 12, 2005, at 04:45PM, Carl Smith <email@hidden> 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
    email@hidden
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >RE: Kernel stack size (From: "Carl Smith" <email@hidden>)

  • Prev by Date: RE: Kernel stack size
  • Next by Date: Re: Kernel stack size
  • Previous by thread: RE: Kernel stack size
  • Next by thread: Re: Kernel stack size
  • Index(es):
    • Date
    • Thread