Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
HOW MUCH MEMORY? ARRAY STRING
#1
Hola, I speak English like Tarzan, sorry to write in Spanish: (And an attempt in English with google translator :oops: )


Tengo un par de dudas:

Creo recordar que cuando declarábamos una matriz alfanumérica DIM a$(10) sin especificar el tamaño, automáticvamente se reservaba en memoria espacio suficiente para cadenas de 255 caracteres para cada uno de los elementos de la matriz. Eso era un gasto de memoria muy caro, sobre todo para los que no sabemos programar y desperdiciamos memoria en cada línea Cry , por eso limitábamos el tamaño mediante DIM a$(10,20) (por ejemplo) para limitar el tamaño de cada elemento a 20 caracteres.

Usando el compilador la instrucción DIM a$ (10,20) no limita el tamaño de cada elemento ,sino que crea una matriz alfanumerica de 10x20.

La duda es si al declarar la matriz DIM a$(n) AS STRING se está reservando memoria para cadenas de 255 caracteres en los n elementos.

El juego que estaba haciendo empezó hacer cosas raras, hasta que me di cuenta que el problema debia ser la falta de memoria (al eliminar arrays de texto el juego volvia a funcionar), ¿como puedo saber cuanta memoria he gastado?, lei que lo que ocupaba el archivo TZX era mas o menos lo que ocupaba el programa, eso es asi?.

--------------

I have a couple of questions:

I remember that when we declared an array alphanumeric DIM a $ (10) without specifying the size, automáticvamente reserved memory space for strings of 255 characters for each of the elements of the matrix. That was a very expensive cost of memory, especially for those who do not know programming and wasted memory on each line Cry , so we just kept the size by DIM a $ (10.20) (for example) to limit the size of each item to 20 characters.

Using the compiler instruction DIM to $ (10,20) does not limit the size of each element, but creates an alphanumeric matrix of 10x20.

The question is whether to declare the array DIM a $ (n) AS STRING is allocate memory for strings of 255 characters in the n elements.

The game was getting started doing strange things, until I realized that the problem was to be the lack of memory (to delete arrays of text the game was returning to work), how I can know how much memory I have spent?, I read that occupied the TZX file more or less what was occupied by the program, it is so?.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)