About 9,140,000 results
Open links in new tab
  1. When do you need to use malloc ()? my code always seems to ... - Reddit

    Malloc is used to get a chunk of memory at runtime. When do you use it? Many applications, the easiest one that comes to mind is when you do not know how much memory you're gonna need when you're …

  2. When and why to use malloc - Stack Overflow

    56 You use malloc when you need to allocate objects that must exist beyond the lifetime of execution of the current block (where a copy-on-return would be expensive as well), or if you need to allocate …

  3. Malloc with Objects in Arduino libraries - Arduino Stack Exchange

    My understanding of using dynamic memory on the arduino is that new/delete are not available, only malloc realloc and such C functions, as mentioned here: C++ & the AVR I am creating a librar...

  4. c - Difference between malloc and calloc? - Stack Overflow

    Oct 8, 2009 · malloc() and calloc() are functions from the C standard library that allow dynamic memory allocation, meaning that they both allow memory allocation during runtime.

  5. Why are you not supposed to use malloc/calloc in embedded ... - Reddit

    In those cases you're forced to either use malloc (including your own implementation of it) or to do the same thing in haphazard and bug prone fashion.

  6. Is using malloc() and free() a really bad idea on Arduino?

    Mar 11, 2014 · The use of malloc() and free() seems pretty rare in the Arduino world. It is used in pure AVR C much more often, but still with caution. Is it a really bad idea to use malloc() and free() with Ard...

  7. c - What does malloc (0) return? - Stack Overflow

    The malloc implementation saves this information in an implementation-specific way. realloc knows the (implementation-specific) way to figure out that ptr points to a memory block of size zero.

  8. I am getting a malloc assertion error when i run my push ... - Reddit

    Aug 15, 2023 · Code isn't super well formatted, so is a bit of a pain to read, what follows is an educated guess. Errors like that tend to indicate heap corruption: probably you went out of bounds on the first …

  9. malloc - C - Design your own free ( ) function - Stack Overflow

    Today, I appeared for an interview and the interviewer asked me this, Tell me the steps how will you design your own free( ) function for deallocate the allocated memory. How can ...

  10. Can you determine the size of a malloc’ed array? - Reddit

    Nope, you just have to store the size somewhere. If you find yourself often needing the size, you could wrap malloc in a function which allocates a few bytes extra, stores the size at the start of the memory …