π
<-

Memory Leak & Calc crash

C, C++, ASM...

Memory Leak & Calc crash

Messagede Rankail » 05 Sep 2021, 12:13

I can open my program and close it but whenever i open and close it multiple times it shows the waiting symbol and after a few seconds the calc in the emulator restarts. Whenever it does so it throws an error in the debugger:
Code: Tout sélectionner
Warning (13a574d0): Data abort: address=0001002f status=01 instruction at 13a574d0.
The numbers are always a bit different.

The calc is cx 4.5.3.14.
There was also a problem where i would get a memory error after restarting a slightly other code around 10-20 times. I couldn't find any memory leaks though. So i spend the last 2-3 days "playing" around with the pointers. Changing from pointers to smart pointers and the other way around. Adding delete for all pointers i found. Nothing seemed to work 100% fine. Anyone can help me? I uploaded my code to github because i honestly don't know what to do anymore. :|
https://github.com/Rankail/nStateMachine

If you want to know anything about how the code should work or i missed some info please tell me
Avatar de l’utilisateur
Rankail
Niveau 4: MC (Membre Confirmé)
Niveau 4: MC (Membre Confirmé)
Prochain niv.: 64%
 
Messages: 21
Inscription: 09 Nov 2019, 18:33
Localisation: Germany, North Rhine-Westfalia
Genre: Homme
Calculatrice(s):
MyCalcs profile
Classe: 12

Re: Memory Leak & Calc crash

Messagede Vogtinator » 06 Sep 2021, 16:26

You have a severe memory leak in Renderer::SetFont: It creates a new font based on the passed parameters, but never frees the old one.

What it should do is only create a font if necessary and take care of the old ones as well. I recommend to create all the needed fonts on startup and avoid dynamic allocation during runtime.
I also recommend to only draw if something changed and use the "idle()" function to wait for the next input event instead of drawing as fast as possible.

The data abort could be caused by a missing check for malloc failure, if it tries to use an invalid null pointer.
Avatar de l’utilisateur
VogtinatorPremium
Niveau 9: IC (Compteur Infatigable)
Niveau 9: IC (Compteur Infatigable)
Prochain niv.: 1.6%
 
Messages: 217
Inscription: 29 Mar 2014, 15:55
Genre: Homme
Calculatrice(s):
MyCalcs profile


Retourner vers Native: Ndless, Linux, ...

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 2 invités

-
Rechercher
-
Social TI-Planet
-
Sujets à la une
Ndless for CX 4.5.5 / CX II 6.2.0
Comparaisons des meilleurs prix pour acheter sa calculatrice !
"1 calculatrice pour tous", le programme solidaire de Texas Instruments. Reçois gratuitement et sans aucune obligation d'achat, 5 calculatrices couleur programmables en Python à donner aux élèves les plus nécessiteux de ton lycée. Tu peux recevoir au choix 5 TI-82 Advanced Edition Python ou bien 5 TI-83 Premium CE Edition Python.
Enseignant(e), reçois gratuitement 1 exemplaire de test de la TI-82 Advanced Edition Python. À demander d'ici le 31 décembre 2024.
Aidez la communauté à documenter les révisions matérielles en listant vos calculatrices graphiques !
12345
-
Faire un don / Premium
Pour plus de concours, de lots, de tests, nous aider à payer le serveur et les domaines...
Faire un don
Découvrez les avantages d'un compte donateur !
JoinRejoignez the donors and/or premium!les donateurs et/ou premium !


Partenaires et pub
Notre partenaire Jarrety Calculatrices à acheter chez Calcuso
-
Stats.
3188 utilisateurs:
>3164 invités
>17 membres
>7 robots
Record simultané (sur 6 mois):
43991 utilisateurs (le 10/09/2025)
-
Autres sites intéressants
Texas Instruments Education
Global | France
 (English / Français)
Banque de programmes TI
ticalc.org
 (English)
La communauté TI-82
tout82.free.fr
 (Français)