Comments (5)
Can confirm memory leaks with loadFont() in a loop till system crashing an reseting.
Update
Checked library and my code, found out, that the library haven't memory leak. A memory leak appear with following code
`function1(){
loadFont();
...
function2();
...
unloadFont();
}
function2(){
loadfont();
drawFont();
unloadFont();
}`
Correct will be:
Example 1
`function1(){
loadFont();
drawFont();
unloadFont();
...
function2();
}
function2(){
loadfont();
drawFont();
unloadFont();
}`
Example 2
`function1(){
...
function2();
...
}
function2(){
loadfont();
drawFont();
unloadFont();
}`
from openfontrender.
Here is my Git
What microcontroller is used? Is the development environment Arduino?
First, have coded with a Arduino board, later switched to ESP32 Dev Board and changed a bit code for ESP32.
Are the fonts to be loaded the same? Are they different?
If you look into my code, you will see there is no different.
Are the fonts loaded from SD?
No. Not tested from SD.
Is there one instance of OpenFontRender? More than one?
I use many Times loadFont() and after that unLoadFont(), but i never use loadFont() loadFont() and then unloadFont() unloadFont(), because, this is the reason for memory leak.
Where is function1 called from? setup or loop?
Yes, in loop
from openfontrender.
Where do you load fonts from?
Also, can you provide the smallest complete code that can reproduce the problem?
Thank you.
from openfontrender.
it have nothing to do with the font itself.
when you use doubles time loadFont() and use unloadFont(), you will get a memory leak. i had posted the smallest code.
this is incorrect:
void function1(){
loadFont();
<-- any code -->
function2();
<-- any code -->
unloadFont();
}
void function2(){
loadfont();
drawFont();
unloadFont();
}
in this example, load font will be load, then a call to function2 with loadFont again without unloadFont before. after second time loadFont comes unloadFont and a second time again. this is not working and will get a memory leak. after loadfont, you will need to unloadFont again, after that u can call the LoadFont again.
from openfontrender.
Please tell me a complete sketch (code) that can be executed by copy-paste to accurately verify the issue.
I have some overall picture with your minimal code, but I do not understand some of the details.
- What microcontroller is used?
- Is the development environment Arduino?
- Are the fonts to be loaded the same? Are they different?
- Are the fonts loaded from SD?
- Is there one instance of OpenFontRender? More than one?
- Where is function1 called from? setup or loop?
Thank you.
from openfontrender.
Related Issues (20)
- Feature request: text wrap HOT 1
- SdFat support? HOT 2
- Please support ARM cortex arch? HOT 2
- Feature Request: Text outline support
- Feature request: loading fonts from SPIFFS/LittleFS HOT 4
- Compilation error using "setBackgroundFillMethod" HOT 1
- How can an integer be printed without sprintf HOT 2
- Nucleo64 : undefined reference to `_open' HOT 6
- STM32H750 HOT 2
- Using SPIFFS instead of SD HOT 2
- Getting flickering with large front redraws HOT 6
- Align::*Right doesn't work quite right? HOT 3
- Text alignment seems shifted down about 50% of glyph height HOT 12
- ESP32 crash with certain configuration HOT 1
- Vertical centering with a line break HOT 4
- Recommendations for memory use? HOT 2
- OpenFontRender support for Teensy 4.1 HOT 16
- Recommendations for code changes HOT 2
- OpenFontRenderer memory requirements of loadFont() function HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openfontrender.