Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: would a soft reset help fix a memory leak?

  1. #1
    Junior Member
    Join Date
    Mar 2021
    Location
    San Francisco
    Posts
    11

    would a soft reset help fix a memory leak?

    Hi all,

    I have a fairly large/complicated project (two teensy 3.6's running six stepper motors in synchrony) and it's all working great... mostly.

    It works flawlessly for an unknown period of time *at least a few days *and then mysteriously stops. Which feels to me like a memory leak, especially since if I reset both teensys via TyCommander, it starts up again fine.

    I know that the REAL answer is to pore through the code line by line and try to figure out where the dynamic memory allocations are not being freed, but since I'm limited in time and resources, I'm thinking that I may instead (or, first) try and implement an automatic reset, once a day, and see if that's enough.

    I found this thread, which I imagine works, but will this have the same effect as a "hard" reset in terms of memory? Or should I need to build in an external hardware watchdog to be sure?

    Related, anyone have any good recommendations for a hardware watchdog or timer?

    Thanks all!
    -Sam

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,274
    Yes, doing that CPU_RESTART will reset the processor and enter setup() with memory and state restored the same as TyCommander's GUI Reset.

    A post in recent days linked to a memory monitoring thread/post, and there are others that may help determine when resources are being used.

  3. #3
    Junior Member
    Join Date
    Mar 2021
    Location
    San Francisco
    Posts
    11
    Awesome. Thanks as always for the speedy and helpful response!

    And yes, I was looking at a couple posts to that effect as well... I'll do some more digging...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •