The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
Please vote in the Forum Structure Poll. Polling will close at 2PM EST on January 21, 2025.

Linux programming: kmalloc issues

Steel AngelSteel Angel Registered User regular
edited March 2008 in Help / Advice Forum
Anyone here familiar with kernel programming? Having an issue where kmalloc seems to be unable to allocate memory. Here's the relevant code:
if (array != NULL ) {
   kfree (array);
}

array = kmalloc (size * sizeof(char), GFP_KERNEL);

if ( KS421 == NULL ) {
   printk ("Error: kmalloc failed to give memory\n");
   return -ENOMEM;
}

The error condition triggers every time. Removing it results in a segmentation fault, so it seems to be accurate. Anything wrong with how I'm allocating memory? I find it hard to believe that I'd have no memory available to give to an array of three characters (my test case).

Big Dookie wrote: »
I found that tilting it doesn't work very well, and once I started jerking it, I got much better results.

Steam Profile
3DS: 3454-0268-5595 Battle.net: SteelAngel#1772
Steel Angel on
Sign In or Register to comment.