Sorting words, stuck in infinite loop.

  • (2 Pages)
  • +
  • 1
  • 2

16 Replies - 2718 Views - Last Post: 05 June 2011 - 12:38 PM Rate Topic: -----

#16 Xupicor   User is offline

  • Nasal Demon
  • member icon

Reputation: 457
  • View blog
  • Posts: 1,179
  • Joined: 31-May 11

Re: Sorting words, stuck in infinite loop.

Posted 05 June 2011 - 11:49 AM

True, still, that's a leak that will be cleaned up by the OS, not that serious on modern OSes, and not as big of an issue since it's not in a function called often. (main() can't be called in C++)
That's still a bit shady practice to not do a cleanup. +1

OP: you should always remember that if you use new/new[] - you need to use delete/delete[] to free the memory. Unless, of course, you use smart pointers, in which case the smart pointer will use delete for you, when the time comes.
Was This Post Helpful? 0
  • +
  • -

#17 AgentSmith   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 04-June 11

Re: Sorting words, stuck in infinite loop.

Posted 05 June 2011 - 12:38 PM

View Postvividexstance, on 05 June 2011 - 11:38 AM, said:

Did no one see my post, or see how the OP's code has a memory leak in it? When you use dynamic memory allocation(using the new operator), there needs to be a delete statement somewhere to delete the memory you allocated with the new operator. If you don't, you will end up with a memory leak which is a serious issue.


I gotcha buddy, I put it in my updated code and your point is earned =)
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2