Hey guys,

First of all I know there have been previous threads like this and that there's also a faq item about this.
But I am unable to apply any of those examples to my problem, simply because I haven't done this before and I dont understand the instructions I've read. Therefore I hope you can help me with this specific problem.

Here's my problem:
I have a LINE_COUNT defined as 10000:

Code:
#define LINE_COUNT                    10000
And I have some structs and arrays defined that use this LINE_COUNT value:
Code:
   char buf[BUFSIZ], id_file[256], id_file_array[LINE_COUNT][30], id_array[LINE_COUNT][30];

   struct CAN_line
   {
      int cnt;
      int time;
      int identifier;
      int datalength;
      int db[8];
   };
   struct CAN_line linenr[LINE_COUNT];
Now when I increase the LINE_COUNT to say 11000 the program hangs. I figured it would have to do with memory available and came across the malloc function as a possible solution for this.
My question is, how should I use malloc in this situation?
Do I request memory for every array and the struct that use this LINE_COUNT? Or maybe I can simply request an amount of space when I launch the program?
Anyway, I have tried the following line but I haven't got a clue if it's right or not and when it is I wouldn't even know how to check if it actually works...

Code:
q = (char *) malloc(2 * sizeof(struct CAN_line));
...
free(q);
Sorry for the noob level of this question It's just so not clear for me how this works.

Any help would be greatly appreciated!

René