ok i made a class and a new pointer object to the class class *a = new class[50] but at the end i forgot to delete them, now i know this will cause a memory leak which is bad but will the memory leak be gone when i re-start the computer so i get all my memory back as some websites speak as if i will loose that part of memory forever or is it just until the program terminates it may sound like a dumb question to some but im just not sure on this one

thanks in advance

The memory is not really lost "forever" -- most operating systems reclaim the memory when the program itself exits either normally or abnormally (crashes). When using current versions of MS-Windows or *nix it is not necessary to reboot the computer.

Is there a reason that you used "new" instead of using a vector?

(By the way, your example cannot work as you posted it, because

class

is a reserved word that you cannot use as a name for your own type)

sorry i just used this as an example, the actual code i have is:
people * a = new people[50]

Ancient Dragon cleared this p for me anyway thanks for your help guys very uch appreciate it

@Qusto: that link is broken

>>@Qusto: that link is broken

He was a spammer, but made a typo in his link :) But he's banned and his posts have been deleted.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.