Messages in this thread | | | Date | Thu, 10 Jan 2002 13:18:35 -0500 | From | Brian Gerst <> | Subject | Re: array size limit in module? |
| |
Fernando Jimenez wrote: > > Hi > > I am trying to code a simple kernel module and I have found a problem I don't > quite understand. > > Here is the offending part of code: > > char *sectors_array = NULL; > ........ > secs_size=131072; > sectors_array = kmalloc(secs_size*sizeof(char), GFP_KERNEL); > for(i=0; i<secs_size; i++) { > sectors_array[i]=0; > } > > This bit of code, as it is, works fine. However, if I increment secs_size by > one, ie, I do 'secs_size=131073;' instead of 131072, I get the following:
Use vmalloc for allocations that large, unless you must have the memory physically contiguous. 128k is the largest amount of memory you can allocate with kmalloc.
--
Brian Gerst - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |