Is there a "clear memory" command in Windows like there was in DOS?

After 20 years of rebooting my computer to clear memory I finally get around to asking.

Not that I know of, but as I understand it, since Windows 95 you’re not really clearing memory, you’re clearing hung threads. You can kind of fake that short of rebooting by going into the Task Manager and killing any processes that are using up lots of memory, with the understanding that some of those processes (most of them, really, unless you’re infested with malware, which is another story; see the thread in ATMB) are doing stuff that you really, really want them to do, like operate the computer system.

At the bottom right corner of your screen, you should see a small blue rectangle. If you put your cursor on top of that blue rectangle, it should display the following “tip”: “Show Desktop”

It may not be at the bottom right corner and may be in a diff location.

If you click on that rectangle, it will minimize all open windows and you will see your desktop.

That is somewhat similar to the DOS “clear command” even though it’s not quite the same thing.

If you can be more specific as to what you need, someone may be able to help you.

Um, yeah, surely, as Charlie Wayne implies, the DOS clear command was about clearing the screen, not clearing the memory.

Perhaps he meant, like unload TSR. There were all sorts of 3rd party commands, eg a utility to save the current state and restore to it, to make it faster to remove a TSR that won’t unload itself.

Programs in windows can remain running, but there is … the task bar’s icons, near the date/clock,
Or the task manager’s task list or process list can kill the task or the process.
But if its a windows service, the process will just restart and so only the service manager can set the service to be off. (Windows 8 has services in the task manager at control-alt-delete as well ,as where it is in most Windows - in control panel, administrative tools, services)

DOS had many different commands that “cleared” one thing or another.

In addition, people used batch files and other utilities to create all kinds of tools that cleared one thing or another.

I guess we need to ask the OP to be more specific as to what he/she wants to accomplish with this “clear” command.

So, OP (Linden Arden), I would ask if you could please be more specific about what you would like to accomplish.

Also, if possible, to avoid confusion, could you please tell us what you recall the DOS clear command did (to the best of your recollection)?

Finally, do you have any experience creating tools using DOS batch files? If so, do you know if the DOS clear command that you remember was ever implemented using batch files?

Thank you.

Darn! I ran out of edit time and now I forget what I thought was so important to include in my post.

Oh Well. What can I do? I would like to curse and swear. Am I permitted to curse and swear in this forum?

I always wondered why there wasn’t a compact memory command in DOS. Back when programmers wrote sloppy code that allocated memory and never released it (memory leaks). Sometimes the memory was still allocated after the program exited.

It seemed like a simple command could check for memory that is allocated to programs no longer running. But DOS never had that feature. Rebooting was the only option.

Memory leaks are still a problem today. Reboot your windows. Note how much memory is used. Use the pc a day or two. Close all the programs. You’ll be amazed how much more memory is being used.

That’s generally not memory leaks; it’s the computer retaining formerly-used pages in case you re-launch the app or re-access the data. There’s no point in actually discarding them until you need the memory back, so it’s pretty normal for memory to simply increase for a while, even under a normally functioning OS with no leaks.

It’s almost impossible to leak memory past the end of your running process in Windows, Mac OS, iOS, or Android – it involves taking almost deliberate action to do so, and the sort of “locked system memory” code isn’t used very much.

Sure, some apps still leak while they’re running, but it’s pretty easy for a developer to check for that, these days, and I haven’t seen too many egregious examples in the last few years.

But does it really matter these days when most computers have memory up the wazoo? It’s a genuine question BTW, I know little about such matters.

I am not an expert in this field. But I believe that a “memory leak” does not just mean that you run out of memory. I believe that it can be caused by several different problems (especially incorrect pointer resolution) and can, in turn, cause all kinds of other failures.

So, you really want to avoid memory leaks and, yes! Even though your PC may have plenty of memory to spare, those errors can still occur and may still cause extremely serious errors (and or crashes) with your PC.

Back in the very early 8086/8088 XT days memory could be allocated anywhere. Even overwriting important system programs. I think it was the 286 processor that included the first protected memory space. I remember assembly programming was a lot harder on the 286 and 386’s.

Windows has memory protected these days. Over writing something important is rare.

To be more specific I think you mean to say Windows supports virtual memory. (As does pretty much any modern OS) In the case of Windows each process gets its own memory space so as far as it’s concerned it’s the only thing living in there.

I wonder if the OP is thinking of the CLR command in Commodore BASIC, which does clear all variable memory and closes all open files.

Aw, those were the days when all you had to do was write code that did exactly what you want, and that’s exactly what the computer did. Couldn’t get much simpler than that! Sure, you had to write your code carefully. But that served very well to separate the Real Programmers from the quiche-eating Pascal Programmers.

Even better, the IBM-1620 not only had the whole OS in unprotected memory . . . The Model I (“CADET”) couldn’t even do simple integer addition, but instead it looked up each addition “fact” in an in-memory add table, just like us older folks did when we were in first grade. (“CADET” stands for “Can’t add; doesn’t even try.”) You could have all kinds of fun by messing with the addition table. You could even load an octal add table and have it do addition in base-8. (Although I hate the think what that might have done to its subtraction algorithm.)

I had a lot of fun and learned a lot writing assembly for my XT 8088. Locked it up a bunch of times and didn’t really care. Shut it off, put in the 5 1/4 floppy and reboot. I wore out my copy of the Waite Group Assembly book. Spine was broke and it was coming apart.

A lot of the fun was lost with the 286 and protected-mode. I quit fooling with assembly after Win for Workgroups 3.1 came out. C is a better language for windows programming.

DOS was never designed to run multiple applications - TSRs were nasty hacks on top of a single user single application OS. So the inability of DOS to manipulate the heap was by design - the single running application was supposed to get all the memory and manage it, then the memory would be released when the application terminated.

That’s coincidental, I just saw this comic:
Does it clear memory?

Yeah, we need to know precisely what the OP means by “clear memory command” in DOS. If you mean ‘clr’, IIRC that just cleared the screen.

FWIW, the “clear screen” command in DOS is cls.