Bonjour,

Dans l'IDE MPLAB-X pour PIC32MZ, pour le linker il y a les paramètres de configuration suivants :
- Heap size (bytes).
- Minimum stack size (bytes).

Dans le fichier ".ld" de mon projet, je vois écrit :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
/*
 * Provide for a minimum stack and heap size
 * - _min_stack_size - represents the minimum space that must be made
 *                     available for the stack.  Can be overridden from
 *                     the command line using the linker's --defsym option.
 * - _min_heap_size  - represents the minimum space that must be made
 *                     available for the heap.  Must be specified on
 *                     the command line using the linker's --defsym option.
 */
EXTERN (_min_stack_size _min_heap_size)
Donc est-ce que _min_stack_size correspond à "Minimum stack size (bytes)" et _min_heap_size à "Heap size (bytes)" ?

Lorsqu'on appelle la fonction malloc, comment cette fonction fait pour déterminer l'espace mémoire restant pour renvoyer une erreur (pointeur NULL) en cas de problème ?
=> Pour moi, l'espace allouable pour la heap devrait être <adresse_de_fin_de_la_RAM> - _min_stack_size - <adresse_de_départ_de_la_heap> ... alors pourquoi il y a deux paramètres à configurer alors qu'un seul devrait suffire ? A quoi servent exactement ces deux paramètres ?

Merci par avance