Function free() shows red squiggly line under it

Go To Last Post
9 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I see my use of "free()" function in code is producing these red squiggly line under it. References cant find where the function is. Anyone else facing this issue? Code actually compiles...it seems to work. But I am worried actual freeing of memory is not being performed?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

if you have stdio.h included, it should be fine. If you're not sure. you can always run Valgrind on the program to check. :) 

Soul

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

There's been plenty of reports of this issue. The program used to validate the code for the IDE is somewhat different to how the gcc compiler interprets things, so you get this disjoint. Google atmel studio red lines

If you're worried about the actual freeing of memory -why not just run the debugger on the code? The reality is most likely that gcc was happy with the code and did what you wanted. Visual Assist just had a different idea.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ok thanks guys.

running debugger is something I having to learn. How is running debugger /valgrind run with atmel studio?

How will debugger tell me unfreed memory?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Put a breakpoint on free() so you can see it being called. You could also investigate the allocation tables to see what is happening.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In your OUTPUT window take a look on the left side of the window and see if there is a capital 'N'.  IF so, then it's an issue with the NAGGY extension.  I ran into this same issue a while back, but cannot remember the name of the thread.  AS long as the code compiles and runs you should be fine.

 

If you can post a screenshot of your output window even better.

 

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

 

"The critical shortage here is not stuff, but time." - Johan Ekdahl

 

"Step N is required before you can do step N+1!" - ka7ehk

 

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

 

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Please Read: Code-of-Conduct

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess that by stdio.h you actually mean stdlib.h

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
There's been plenty of reports of this issue. The program used to validate the code for the IDE is somewhat different to how the gcc compiler interprets things, so you get this disjoint.

And the same applies to Eclipse.

 

frown

 

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

On Wed. Jan 4, 2017, Kartman wrote:
There's been plenty of reports of this issue.

And already another one by Sunday: https://www.avrfreaks.net/forum/a...

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...