Dynamic array allocation in a structure

Hello,

I am having a problem on deciding how to implement the dynamic allocation of an array in a structure effectively.

I have a structure as following

struct block_properties

{

	long int no_of_tri, no_of_loops;

	long int loops[512];

	long int index;

	long int end_index;

};

In kernel I have two for loops:

for(i=index+tid; i< block_p[bid].end_index - 2; i=i+blockDim.x)

	{

		for(j=i+1+tidy; j < block_p[bid].end_index; j=j+blockDim.y)

		{

						   // For simplicity I removed the actual code

						   roller++;

		}

				block_p[bid].loops[] = roller;

	}

Now, I am not able to find a good way to allocate memory for the loops array. Can anyone give me a suggestion.

Note: I am planning to use 23 x 22 threads per block and 128 blocks. end_index varies upon input and goes upto 25,000.

Sambi