FW: Kernel stack size
FW: Kernel stack size
- Subject: FW: Kernel stack size
- From: "Carl Smith" <email@hidden>
- Date: Tue, 12 Apr 2005 18:09:31 -0400
- Thread-topic: Kernel stack size
Ah thanks Brian, and Justin.
To be more precise I had a global array with three pointers in it to char* buffers. i.e char* buf1, char* buf2 and so on.
I set the global array at a size of 50. So I had a 50 structures contain my three char pointers.
At run time I was creating the buffers dynamically for the char pointers at 1600 bytes each.
So that was 4800 bytes I was allocating per loop, when I reached the loop count of 10, I could create the first char buffer in the array, but as I went to create the second char buffer in array 10, I noticed the loop counter, which was a global int, was reset to zero.
And where I was getting the kernel panics was when I went to unload the NKE, because I was trying to free the allocated memory but the global counter, g_ArrayIndex, was out of whack.
I'll keep looking at the pointer doing after doing the _MALLOC and see if anything is going wrong there, but could my array be too large? I would not think so because I am only declaring pointers, no large amounts of data.
Thanks
Carl
-----Original Message-----
From: Brian Bergstrand
Sent: Tuesday, April 12, 2005 5:40 PM
To: Carl Smith
Cc: email@hidden
Subject: Re: Kernel stack size
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The kernel stack size is fixed at 16KB (last I heard) per thread.
MALLOC does not use stack mem, and incrementing an existing var does
not use the stack, and finally if you really were blowing the stack
it's an almost certainty that a panic would closely follow. So
something else is probably going on. You may be scribbling on the stack
via a bad ptr and thus overwriting your counter.
On Apr 12, 2005, at 4:31 PM, Carl Smith wrote:
> Is there a way to determine the kernel stack size dynamically?
>
> I am allocating some buffers using _MALLOC and after about a loop of
> 10, the global incremental counter resets itself to 0, so I am
> thinking I am blowing the stack size.
>
> Thanks
> Carl
>
Brian Bergstrand <http://www.bergstrand.org/brian/>, AIM: triryche206 PGP Key: <http://www.bergstrand.org/brian/misc/public_key.txt>
You cannot make a man by standing a sheep on its hind legs. But by
standing a flock of sheep in that position you can make a crowd of men.
- - Max Beerbohm
As of 04:33:18 PM, iTunes is playing "Once In A Lifetime / The Killing
Words" from "Identity Crisis" by "Section 16"
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.1
iQA/AwUBQlwyI3nR2Fu2x7aiEQISXQCfUnAhImVl+DSr5uxlDRF/6z4x/L8An3ZB
JXRrOqWPD2Yh4auVxxgJONMT
=5rh0
-----END PGP SIGNATURE-----
_______________________________________________
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