freeing ram (aka ram defragmentation)?

Just starting out? Need help? Post your questions and find answers here.
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

MEMORY LOSS v1.0 ;)

Post by NoahPhense »

muab256 wrote:this one looks nice =)

at least it works, ur right, its not the fastest solution, but
- one can try to make it better
- its way not as slow as i expected after reading ur post ;P

many thx
Ok, I've had a few more minutes to tool with it..

Quite fast now.. and on the fly. Sorry for the elongated post. But it had to be that way.

- john

Code: Select all

code remove.. see below
Last edited by NoahPhense on Tue Oct 21, 2003 1:02 am, edited 1 time in total.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

why not replace readdata with lset() ?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

good idea..

Post by NoahPhense »

blueznl wrote:why not replace readdata with lset() ?

Yeah, that's a great idea.. I'm still learning the language.. ;) I think this is like my 14th post..

Thanks for the tipage!!

- john

Code: Select all

DefType.s Data1
;- CREATE 1K
Data1 = LSet("", 1000, "a")

NewList Memory.s()

;- CREATE 64K
For x = 1 To 6
    Data1 = Data1 + Data1:; CREATING 64K
Next x

;- RUN CONSOLE
If OpenConsole()
    ConsoleTitle("Memory Loss v1.0")
    Print("megs: ")
    megs.s = Input()
    megsNumber.w = Val(megs)
    PrintN("")
    If megsNumber = 0
        Goto GetOut
    EndIf

    ;- CREATE 1024K
    For x = 1 To megsNumber*16:; 64K X 16 = 1024000
        AddElement(Memory())
            Memory() = Data1
    Next x

    PrintN("done..")

    Repeat
    Until Inkey()<>""
    GetOut:
    CloseConsole()
EndIf

ClearList(Memory())
End
muab256
User
User
Posts: 43
Joined: Mon Apr 28, 2003 4:57 pm

Re: good idea..

Post by muab256 »

NoahPhense wrote:
blueznl wrote:I'm still learning the language.. ;)
hehe, imho we all do... forever ;P
great... had allready a faster mod of urs (but not as accurate as urs)...
well, this one looks even faster =)

muab
User avatar
NoahPhense
Addict
Addict
Posts: 1999
Joined: Thu Oct 16, 2003 8:30 pm
Location: North Florida

Re: good idea..

Post by NoahPhense »

muab256 wrote:hehe, imho we all do... forever ;P
great... had allready a faster mod of urs (but not as accurate as urs)...
well, this one looks even faster =)
Kewl, glad it works for ya.. It's a pretty good core start. If I was building it, from there, I would probably get how much physical memory is on the EU's (enduser) machine. I'm sure there is a simple API for that.

Then I would probably allow the user to set where he/she would like the mem-recovery to take place. Look back at the screen shots, to see the different features, like Target Free Ram.. that's when its doing a scrub, where it should stop. Because if you try to recover all physical memory, it will work, BUT, you will have really slowed down the box for a while.. because you've crapped everything that was running into the swap file.

i.e. - When the memory hits 80mb's, run defrag.

I'm just basing those ideas off of my currrent memory program, as they are pretty nice.

- AutoRecovery Level
- a button to manually kick off the defrag

There are many features, you just have to be creative. To me, thats the fun part about programming. The creation process.

- john
muab256
User
User
Posts: 43
Joined: Mon Apr 28, 2003 4:57 pm

Post by muab256 »

think such feature loaded ram defrager are enough out there...
so here what i do:

a "screen saver" which will free up ram and set the disk cache very
high, and reduces cache/frees ram again when system is in use again =)

muab
Post Reply