Click here to Skip to main content
15,890,512 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Using dynamic memory in microcontrollers Pin
honey the codewitch25-Feb-23 7:29
mvahoney the codewitch25-Feb-23 7:29 
GeneralRe: Using dynamic memory in microcontrollers Pin
CPallini25-Feb-23 7:42
mveCPallini25-Feb-23 7:42 
GeneralRe: Using dynamic memory in microcontrollers Pin
honey the codewitch25-Feb-23 7:54
mvahoney the codewitch25-Feb-23 7:54 
GeneralRe: Using dynamic memory in microcontrollers Pin
jschell28-Feb-23 5:39
jschell28-Feb-23 5:39 
GeneralRe: Using dynamic memory in microcontrollers Pin
CPallini28-Feb-23 10:03
mveCPallini28-Feb-23 10:03 
AnswerRe: Using dynamic memory in microcontrollers Pin
OriginalGriff25-Feb-23 5:52
mveOriginalGriff25-Feb-23 5:52 
GeneralRe: Using dynamic memory in microcontrollers Pin
CPallini25-Feb-23 6:22
mveCPallini25-Feb-23 6:22 
GeneralRe: Using dynamic memory in microcontrollers Pin
honey the codewitch25-Feb-23 22:21
mvahoney the codewitch25-Feb-23 22:21 
I've found that you can create robust systems that malloc just fine as long as you're careful.

I mean, I'm not saying you shouldn't avoid it, but used judiciously you can get away with it without having to worry that your code will crash a week in.

Basically, you allocate small amounts and throw them away quickly.

Then if you're really concerned you can profile to make sure you aren't leaking and have enough headroom, but in practice I don't even find I need to do that most of the time.

Edit: If you use common libraries like LVGL to provide a user interface for example, those will often malloc in the background.
To err is human. Fortune favors the monsters.


modified 26-Feb-23 4:55am.

AnswerRe: Using dynamic memory in microcontrollers Pin
Ron Anders25-Feb-23 6:07
Ron Anders25-Feb-23 6:07 
GeneralRe: Using dynamic memory in microcontrollers Pin
CPallini25-Feb-23 6:17
mveCPallini25-Feb-23 6:17 
GeneralNo sea too high Pin
RickZeeland25-Feb-23 2:52
mveRickZeeland25-Feb-23 2:52 
GeneralRe: No sea too high Pin
BillWoodruff25-Feb-23 4:45
professionalBillWoodruff25-Feb-23 4:45 
GeneralRe: No sea too high Pin
RickZeeland25-Feb-23 6:46
mveRickZeeland25-Feb-23 6:46 
QuestionRe: No sea too high Pin
Eddy Vluggen25-Feb-23 11:28
professionalEddy Vluggen25-Feb-23 11:28 
AnswerRe: No sea too high Pin
RickZeeland25-Feb-23 18:48
mveRickZeeland25-Feb-23 18:48 
GeneralRe: No sea too high Pin
Eddy Vluggen26-Feb-23 7:23
professionalEddy Vluggen26-Feb-23 7:23 
GeneralRe: No sea too high Pin
Richard Deeming26-Feb-23 22:43
mveRichard Deeming26-Feb-23 22:43 
GeneralRe: No sea too high Pin
RickZeeland26-Feb-23 23:00
mveRickZeeland26-Feb-23 23:00 
RantI hate learning new technologies. Pin
Maximilien25-Feb-23 2:28
Maximilien25-Feb-23 2:28 
GeneralRe: I hate learning new technologies. Pin
Mike Hankey25-Feb-23 2:35
mveMike Hankey25-Feb-23 2:35 
GeneralRe: I hate learning new technologies. Pin
RickZeeland25-Feb-23 2:43
mveRickZeeland25-Feb-23 2:43 
GeneralRe: I hate learning new technologies. Pin
Slow Eddie25-Feb-23 3:15
professionalSlow Eddie25-Feb-23 3:15 
GeneralRe: I hate learning new technologies. Pin
Mircea Neacsu25-Feb-23 3:33
Mircea Neacsu25-Feb-23 3:33 
GeneralRe: I hate learning new technologies. Pin
RickZeeland25-Feb-23 4:24
mveRickZeeland25-Feb-23 4:24 
GeneralRe: I hate learning new technologies. Pin
Mircea Neacsu25-Feb-23 4:41
Mircea Neacsu25-Feb-23 4:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.