freeing ram (aka ram defragmentation)?
freeing ram (aka ram defragmentation)?
heyas!
id like to write a tiny tool to "completely" free my ram (also known as
defragment ram).
think this is done by filling my complete ram with some data so other
stuff is removed/moved to swap, and then releasing (clean) the used
ram again... right?
so how could i fill the ram?
thx
muab
id like to write a tiny tool to "completely" free my ram (also known as
defragment ram).
think this is done by filling my complete ram with some data so other
stuff is removed/moved to swap, and then releasing (clean) the used
ram again... right?
so how could i fill the ram?
thx
muab
Allocating memory is pretty easy but managing it on the level you'd lik eto probably isn't (though I can't say for sure!)..
PureBasic has several native functions for memory manipulation, check out the memory lib in the documentation.. There are also lots of Win API functions to deal with memory (GlobalAlloc_() and HeapAlloc_() to name a few).. You'll have to look those up in Microsoft's documentation..
PureBasic has several native functions for memory manipulation, check out the memory lib in the documentation.. There are also lots of Win API functions to deal with memory (GlobalAlloc_() and HeapAlloc_() to name a few).. You'll have to look those up in Microsoft's documentation..
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
thats the one i actually use =)dmoc wrote:http://www.analogx.com
i prefer having tools i can _really_ control though, also i thought
this is a quite interesting question =P
-
- Enthusiast
- Posts: 202
- Joined: Sun Apr 27, 2003 4:44 am
- Location: Michigan, USA
- Contact:
Hi,
try this one:
F.
try this one:
Code: Select all
;
; FreeRAM
;
*freecache=AllocateMemory(1,100000000,0)
;
;if you have 128MB RAM
;100000000 = ca. 3/4 of the installed memory

F.
pIII@1Ghz, wXP, 512MB, pb3.93full
I didn't test it, but in Visual Basic it works like this:
The script request 100MB for the string, and frees the memory if it ends.
In PB you may have to fill the Memory with some values.
F.
Code: Select all
;
; Visual Basic Code !!!!!!!!!!!!!!!!!!!
;
a=string(100000000,"x")
In PB you may have to fill the Memory with some values.
F.
pIII@1Ghz, wXP, 512MB, pb3.93full
It could work like this:muab256 wrote:umm... and how would i do that? ;PFred wrote:Windows doesn't map a ram area if it's not used. So just very a byte at the very end of the buffer an d the whole ram will be allocated.
Code: Select all
*freecache=AllocateMemory(1,100000001,0)
PokeB(*freecache+100000000,1)
pIII@1Ghz, wXP, 512MB, pb3.93full
didnt work either =(
same to this "solution"... it is never used more than 1.5mb ;(
muab
Code: Select all
to_free=192
Dim mem_filler.s (1024)
mb.s="X"
For n = 1 To 10 : mb=mb+mb : Next
For mb_count=1 To to_free
mem_filler(mb_count)=mb
Next
Delay(10000)
End
muab
- NoahPhense
- Addict
- Posts: 1999
- Joined: Thu Oct 16, 2003 8:30 pm
- Location: North Florida
Re: freeing ram (aka ram defragmentation)?
Sorry, was goofin around.. maybe this will give you some ideas... I personally wouldn't use it. Because of the time it takes to load the variables.. but I'm sure Fred could point you in the right direction.
I use MemTurbo myself.. on an Ultra stable 2k platform.. love it, will not use anything else.. unless of course I created it myself..
Code's a bit sloppy..
Screen shots of MEMTURBO 2 (below)



- john
I use MemTurbo myself.. on an Ultra stable 2k platform.. love it, will not use anything else.. unless of course I created it myself..

Code's a bit sloppy..
Screen shots of MEMTURBO 2 (below)
Code: Select all
DefType.s a, b, key
NewList memBlock.s()
If OpenConsole()
ConsoleTitle("Windoze eat your heart out...")
ClearConsole()
PrintN("")
Print("How many megs do ya want to eat up: ")
HowManyMegs$ = Input()
mbs.w = Val(HowManyMegs$)
PrintN("")
Gosub LoadVariables
For x = 1 To (mbs*20)
AddElement(memBlock())
memBlock() = a
Next x
For x = 1 To mbs
AddElement(memBlock())
memBlock() = b: ; lets add on 24k per mb that the user selected, you know 1024k ..
Next x
PrintN("smash a key...")
Repeat
key = Inkey()
Until key<>""
CloseConsole()
EndIf
ClearList(memBlock())
End
LoadVariables:
PrintN("")
PrintN("Please standby, loading variables...")
For x = 1 To 49999: ; did this because a string is really length of string +1.. wanted 50k per block
a = a + "a"
Next x
For x = 1 To 23999: ; same, wanted 24k block.. for the 1024k
b = b + "b"
Next x
PrintN("..variables loaded")
PrintN("")
Return



- john