simulated, since the software might behave differently under different memory
sizes, Fig. 20.6.
Freeing
After completing working with the particular instance of the erric_t structure, the
memory
taken
by
it
should
be
freed
by
using
the
free_erric(struct erric_t*erric): (Fig. 20.7).
Memory setup
After the structure for the processor has been created, its memory should be filled
with needed data and code, which can be done either by loading a file with
read_file(char *filename, struct erric_t *erric)
or by setting it up manually, Fig. 20.8.
{
struct erric_t* default = init_erric();
struct erric_t* sized = init_erric_m(1024);
}
Fig. 20.6 The memory size structure
{
struct erric_t* erric = init_erric();
// ...
free_erric(erric);
}
Fig. 20.7 The memory release
{
struct erric_t * erric = init_erric();
read_file(filename, erric);
// ...
free_erric(erric);
}
Fig. 20.8 The memory setup
Appendix 2: Practical Introduction and Developer’s Guide
303
Précédent

- 310/315

Suivant