Matt Jaffa writes:
Hi,
I was wondering if there is a limit within a NKE of how much data can
be allocated.
For instance my NKE is working great until a packet with a length of
65000+ come in and when this line
is reached unsigned char buffer[sizeofpacket] it crashes cause it
if you have something like int foo(...) { unsigned char buffer[sizeofpacket]; ... } in your code, then buffer is allocated on the _stack_. Kernel stack is of small fixed size and is not auto-expandable (as it is in the user-space). You should never ever allocate large data structures on stack in the kernel. Use dynamic memory allocation facilities instead.
is too big I guess, usually packets are only 2 - 1000 so this has no
problem, when I remove that line of code my NKE never crashes.
So what is the limit of what I can do? I mean the size of the unsigned
char buffer[size].
Matt
Nikita. _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.