Re: just one clerification

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 2003-01-09 at 13:05, Rajaram Suresh Gaunker wrote:

> why we can't have static memory (arrays) in kernel function , 
> kernel crashes if i use, i fixed it by dynamically allocating the 
> memory

The kernel stack is only two pages (8KB on x86).  This is shared not
just be your function but by the entire call chain before it and all
interrupts that occur.

Limit your on-the-stack allocations appropriately.  Your example was
_way_ too big.

For stuff that big, or even half as big, use kmalloc() and do not forget
to kfree()!

	Robert Love

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux