Search the Community
Showing results for tags 'new'.
Found 1 result
I've been making some updates to the RetroCade codebase. I pulled down a Queue class from the Arduino code gallery and made a few modifications to it. I am having some stability issues after a bunch of new/delete operations, I get a hard crash and the Papilo freezes. I've done some troubleshooting, but as far as I can tell I don't have any memory leaks. To shed some light on what's going on, I added two global variables: one for allocations and one for de-allocations. These are incremented and decremented with each operation. I dump these values out to the console periodically and haven't detected any memory leaks. In my particular case there are at most 3 dynamically allocated objects at a given time. The alloc/dealloc counts are exactly what I am expecting: If I have 303 allocs then deallocs would be somewhere between 300-302. tldr; Do I need to do anything other than call delete to ensure dynamically allocated memory is freed up? Is it preferable to use C-style allocation/deallocations for applications like this? Can anyone recommend any profiling tools I can run to help me track down memory issues? Since I know the maximum amount of memory I will ever need ahead of time, would it be better to create a statically allocated pool of objects and pull them out of the pool when needed instead of dynamically allocating memory? Thanks, Brian