Announcement

Collapse
No announcement yet.

How to clear cache and browser memory using powerbasic program

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to clear cache and browser memory using powerbasic program

    I would like to clear cache and browser's memories using a powerbasic program.
    Is this possible? Internet Browsers would like IE , MS Edge , Chrome , Firefox

  • #2
    Anne,

    There is a crude technique that used to work well on the much older Win9x.

    Allocate memory in progressive blocks until the allocation fails (return value) then release it all. I have not had to bother on later OS versions. Dimension an array of pointers, put each allocation handle into array members so you can easily keep track of them then when the allocation fails (you run out of memory) go back through the pointer array and release each memory block.

    The old GlobalAlloc() and GlobalFree() pair will do this with no problems.

    On a 64 bit system this will only work on 32 bit address range.
    hutch at movsd dot com
    The MASM Forum

    www.masm32.com

    Comment


    • #3
      There may also be command line options for the major browsers that could be shelled to.
      https://linuxhint.com/removing_cache_chrome/

      This link deletes files
      https://catonmat.net/clear-privacy-i...-chrome-safari

      Be careful.
      I put the commands for chrome in a batch file and it definitely wiped out user names and passwords!
      at this location set ChromeDir=C:\Users\%USERNAME%\AppData\Local\Google\Chrome\User Data

      ------------------------------------------------------------------------------------------------------------------------------------------------------------------
      PowerShell might be used if you can't find anything else.
      Here is a link by 'lemtek' that might do the browsers: https://github.com/lemtek/Powershell...Browser_Caches
      Correction of above by 'lemtek' in his history: https://github.com/lemtek/Powershell/commit/c0baadc4a28fe249a183d2de334f6a8b08c356b1

      I do not know how to write PowerShell scripts so this is just playing with it by
      creating an "easy.bat" batch file with multiple PowerShell commands in it and shelling to the batch file.
      Code:
      FUNCTION PBMAIN AS LONG
      
       OPEN "easy.bat" FOR OUTPUT AS #1
       PRINT #1,"PowerShell Write-Output 'This is line one' 'This is line two' '' > part1.txt"
       PRINT #1,"PowerShell start-process cmd.exe '/c dir' -NoNewWindow   > part2.txt"
       PRINT #1,"COPY part1.txt + part2.txt part3.txt"
       CLOSE #1
      
       SHELL("easy.bat",0)
       SHELL(ENVIRON$("COMSPEC") + " /C part3.txt",0)
       'https://www.educba.com/powershell-functions/?source=leftnav
      END FUNCTION
      Last edited by Mike Doty; 12 Oct 2021, 08:59 AM.

      Comment


      • #4
        Thanks Mike
        The Powershell scripts provided by lemtek did not work but I will try another way
        by modifying these scripts.

        Comment


        • #5
          Originally posted by Anne"
          I would like to clear cache and browser's memories using a powerbasic program.
          When do you want to do that?

          Comment


          • #6
            Well, you may need to clear up those unwanted memories that are lingering wastefully in the background.
            Otherwise, your PowerBasic programs may not be able to utilize the entire system memories to run effectively?
            It is also good for anti virus security counter measures as malware do linger around in the memories and cache
            that can harm the system.

            Comment


            • #7
              OK

              I have my browser cache, Firefox, on a RAM disk which does not save the contents on unmounting. There is a bonus in that the cache is accessed via RAM as opposed to a HDD or SSD. I have been doing this since Windows 98 with the Temporary Internet Files of Internet Explorer. I am currently using 17MB, 231 files, of a 128MB RAM disk. I don't visit many websites, and I am not a heavy tab user.

              Comment


              • #8
                I have only been relocating cache2. On updating SoftPerfect's RAM Disk I see that they have a free app, called 'SoftPerfect Cache Relocator', to redirect the Profiles folder, which includes cache2, to another location.

                The app will relocate the cache for Opera, Mozilla Firefox and Google Chrome.

                I will use more of the RAM disk now, so may change it to 256MB — I will keep an eye on it.

                I have just used it and see cache2 and much more besides.

                Comment


                • #9
                  Well, you may need to clear up those unwanted memories that are lingering wastefully in the background.
                  Otherwise, your PowerBasic programs may not be able to utilize the entire system memories to run effectively?
                  ???

                  Processes - which do user memory, yes - which are "lingering" ("lurking?") will almost surely be swapped out until such time are they are actually used, freeing the RAM for more immediate user requirements. Microsoft actually did a pretty good job with this 'virtual memory' thing.
                  Michael Mattias
                  Tal Systems (retired)
                  Port Washington WI USA
                  [email protected]
                  http://www.talsystems.com

                  Comment


                  • #10
                    You need 64 bit to access all application memory. As most will have a 64 bit CPU and a 64 bit operating system, allocating memory until the allocation fails (by return value) will flush any leftover junk in memory but I suggest that it is probably a waste of time as 64 bit Windows memory management makes accessing memory from any other process than what allocated it, extremely difficult to near impossible. The simple way to clear memory is reboot the computer.
                    hutch at movsd dot com
                    The MASM Forum

                    www.masm32.com

                    Comment

                    Working...
                    X