Re: freeing memory

From: Bordi Zhou (bordi@bronzesoft.org)
Date: Sun Oct 22 2000 - 04:10:02 EST


  It's not a fault of kernel, it's just a mistake.
you should use
for(i=0 to 9)
pAddr[10] only has a range of 0 to 9.
miic> f_malloc()
miic> {
miic> .....
miic> for (i=1 to 10)
miic> {
miic> size = 1000;
miic> pAddr[i] = (unsigned long) kmalloc(size, GFP_DMA | GFP_BUFFER);
miic> }
miic> ...
miic> }

miic> and freeing the allocated memory as follows

miic> f_free()
miic> {
miic> .....
miic> for (i=1 to 10)
miic> {
miic> kfree(pAddr[i]);
miic> }
miic> }

miic> pAddr is defined as 'unsigned long pAddr[10]'

miic> But when f_free executes i ran into problems and computer hangs.
miic> What can be the problem?????

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:18 EST