location of a long aray in memory
mike goettling
Posts: 31
i have a long array···· long·· array[noparse][[/noparse]tiles/2]·
can i specify were in memory it is. i want the array to be at the end of program and·variable ·space.
the way my program is laid out now it has variables after it. i want the array it be the last varable do to issues with the way the user writes to it.
mike
can i specify were in memory it is. i want the array to be at the end of program and·variable ·space.
the way my program is laid out now it has variables after it. i want the array it be the last varable do to issues with the way the user writes to it.
mike
Comments
You could allocate it in the stack during the program's initialization and pass its address around.
In the Propeller OS, I allocate a lot of tables and work areas at the end of memory, starting at $8000 and working "downwards" towards the program's stack. This occurs during the OS's initialization and the pointers to the various tables are stored in global variables at fixed locations in the high end of memory.
Your problem is that immediately after the end of the code and data in memory comes the stack, which increases in size upwards from there. So even if you arrange the array to be the last thing in the program, it and the stack are going to interfere with each other if you decide to grow the array beyond the declared size. As Mike Green suggests, your best option is probably to arrange it so that your array grows downwards from $8000.