forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


GT-MemoryReclaim

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Sat Feb 02, 2008 4:25 pm    Post subject: GT-MemoryReclaim Reply with quote

Im trying to use this script with 4GB RAM system but it stops filling RAM at 1.9GB...

Is there any LIST limitation for amount of data... Question

http://www.vdsworld.com/search.php?keywords=GT-MemoryReclaim&match_type=%200&sid=caf98729ea1026edb6607d1670e04c68
Back to top
View user's profile Send private message Send e-mail
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Feb 02, 2008 5:32 pm    Post subject: Reply with quote

There is a delphi (and therefore VDS) issue with integers larger than 2G - where they become negative. This affects @sum, @diff, etc. Adding 2G to the negative integers and using fractional functions, like @fsub, @fmul, @fdiv etc, is one work around.
_________________
cheers

Dave
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Sat Feb 02, 2008 9:35 pm    Post subject: Reply with quote

At the time I made that also, I don't believe memory even went over 1 gig. So I wouldn't have even known of the issue at the time. And I don't know of any fix for it either. Sad
_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Sat Feb 02, 2008 11:58 pm    Post subject: Reply with quote

filip, it *should* be as simple as changing this section
Code:
  Repeat
    List Add,2,@text(1)
    %%Null = @sum(%%Null,1)
    Dialog Set,TEXT3,Reclaiming memory / %%Null
  Until @equal(%%Null,%%TotalMem)

to this
Code:
  Repeat
    List Add,2,@text(1)
    %%Null = @fadd(%%Null,1)
    Dialog Set,TEXT3,Reclaiming memory / @name(%%Null)
  Until @equal(@name(%%Null),%%TotalMem)

but I don't have any Windows PCs with more than 1GB of ram to test it.

_________________
cheers

Dave


Last edited by DaveR on Sun Feb 03, 2008 4:50 am; edited 1 time in total
Back to top
View user's profile Send private message
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Sun Feb 03, 2008 1:07 am    Post subject: Reply with quote

filip,
You can try replacing the code that the GT-MemoryReclaim program uses to reclaim memory with the following GadgetX code. It should work but I have not tried it on a system with as much memory as yours has.

Code:

#-----------------------------------------------------------------------------#
#                                                                             #
# Example of how to do what GT_memoryreclaim used to do with GadgetX          #
#                                                                             #
# Author: Johnny Kinsey                                                       #
#                                                                             #
# Copyright: Copyright © 2008 DragonSphere Software                           #
#                                                                             #
#-----------------------------------------------------------------------------#

External GadgetX.dll,5.0
# GadgetX functions used with this program
#Define Command,DEFINE,FREEDLL,STRUCTURE,SETVAR,MEM
#Define Function,CALLFUNCPTR,GETFUNCPTR,LOADDLL,MEM,ADDROF,SIZEOF,GETVAR,INT64MUL

# User Defined Function
#Define Function,RECLAIMMEMORY,MemoryInfo

# We will reuse this structure over and over again for memory info
Define Structure,MEMORYSTATUSEX
   Structure Add,MEMORYSTATUSEX,DWORD|dwLength
   Structure Add,MEMORYSTATUSEX,DWORD|dwMemoryLoad
   Structure Add,MEMORYSTATUSEX,QWORD|ullTotalPhys
   Structure Add,MEMORYSTATUSEX,QWORD|ullAvailPhys
   Structure Add,MEMORYSTATUSEX,QWORD|ullTotalPageFile
   Structure Add,MEMORYSTATUSEX,QWORD|ullAvailPageFile
   Structure Add,MEMORYSTATUSEX,QWORD|ullTotalVirtual
   Structure Add,MEMORYSTATUSEX,QWORD|ullAvailVirtual
   Structure Add,MEMORYSTATUSEX,QWORD|ullAvailExtended
# Load the Kernel32.dll
Define Constant,kernel32,@LoadDLL(kernel32.dll)

# All definitions are complete so now lets use some of this stuff to
# free up our physical RAM.

# Get the current memory information
Parse "%%MemoryLoad;%%PhysicalMemory;%%AvailablePhysicalMemory;%%TotalPageFile;%%AvailablePageFile;%%TotalVirtual;%%AvailableVirtual",@MemoryInfo()
Info Current Memory Status@CR()Percent Used: %%MemoryLoad"%"@CR()Total: %%PhysicalMemory@CR()Available: %%AvailablePhysicalMemory@CR()Total Page File: %%TotalPageFile@CR()Available Page File: %%AvailablePageFile@CR()Total Virtual: %%TotalVirtual@CR()Available Virtual: %%AvailableVirtual
# Reclaim the physical memory and lower the memory load
Parse "%%MemoryLoad;%%PhysicalMemory;%%AvailablePhysicalMemory;%%TotalPageFile;%%AvailablePageFile;%%TotalVirtual;%%AvailableVirtual",@ReclaimMemory()
Info Memory status after memory reclaimed@CR()Percent Used: %%MemoryLoad"%"@CR()Total: %%PhysicalMemory@CR()Available: %%AvailablePhysicalMemory@CR()Total Page File: %%TotalPageFile@CR()Available Page File: %%AvailablePageFile@CR()Total Virtual: %%TotalVirtual@CR()Available Virtual: %%AvailableVirtual
# clean up and close the program
# Free the kernel32.dll
FreeDLL kernel32
Stop
:ReclaimMemory
  # This function will reclaim Memory using the a similar method
  # to the GT_MemoryReclaim program by Garrett
  #
  # This function has not arguments
  # The function returns the following memory information separated
  # current VDS field seperator
  # Memory Load@fsep()Total Physical Memory in bytes@fsep()Avail Physical memory in bytes@fsep()Total size of the Page File in bytes@fsep()Available Page File bytes@fsep()Total Virtual memory in bytes@fsep()Available Virtual memory in bytes
  # Syntax: Parse "%%MemoryLoad;%%PhysicalMemory;%%AvailablePhysicalMemory;%%TotalPageFile;%%AvailablePageFile;%%TotalVirtual;%%AvailableVirtual",@ReclaimMemory()
  #
  SetVar MEMORYSTATUSEX.dwLength,@SizeOf(MEMORYSTATUSEX)
  %B = @CallFuncPtr(NULL,@GetFuncPtr(kernel32,GlobalMemoryStatusEx),Pointer|@AddrOf(MEMORYSTATUSEX))
  # Next 2 lines actually does the memory reclaiming the rest of the code only gathers info to do the reclaim.
  %A = @Mem(Alloc,@GetVar(MEMORYSTATUSEX.ullTotalPhys))
  Mem Free,%A
  SetVar MEMORYSTATUSEX.dwLength,@SizeOf(MEMORYSTATUSEX)
  %B = @CallFuncPtr(NULL,@GetFuncPtr(kernel32,GlobalMemoryStatusEx),Pointer|@AddrOf(MEMORYSTATUSEX))
  %R = @GetVar(MEMORYSTATUSEX.dwMemoryLoad)@fsep()@GetVar(MEMORYSTATUSEX.ullTotalPhys)@fsep()@GetVar(MEMORYSTATUSEX.ullAvailPhys)@fsep()@GetVar(MEMORYSTATUSEX.ullTotalPageFile)@fsep()@GetVar(MEMORYSTATUSEX.ullAvailPageFile)@fsep()@GetVar(MEMORYSTATUSEX.ullTotalVirtual)@fsep()@GetVar(MEMORYSTATUSEX.ullAvailVirtual)
Exit %R

:MemoryInfo
  # This function returns all the Global Memory information for your system
  #
  # This function has not arguments
  # The function returns the following memory information separated
  # current VDS field seperator
  # Memory Load@fsep()Total Physical Memory in bytes@fsep()Avail Physical memory in bytes@fsep()Total size of the Page File in bytes@fsep()Available Page File bytes@fsep()Total Virtual memory in bytes@fsep()Available Virtual memory in bytes
  # Syntax: Parse "%%MemoryLoad;%%PhysicalMemory;%%AvailablePhysicalMemory;%%TotalPageFile;%%AvailablePageFile;%%TotalVirtual;%%AvailableVirtual",@MemoryInfo()
  #
  SetVar MEMORYSTATUSEX.dwLength,@SizeOf(MEMORYSTATUSEX)
  %B = @CallFuncPtr(NULL,@GetFuncPtr(kernel32,GlobalMemoryStatusEx),Pointer|@AddrOf(MEMORYSTATUSEX))
  %R = @GetVar(MEMORYSTATUSEX.dwMemoryLoad)@fsep()@GetVar(MEMORYSTATUSEX.ullTotalPhys)@fsep()@GetVar(MEMORYSTATUSEX.ullAvailPhys)@fsep()@GetVar(MEMORYSTATUSEX.ullTotalPageFile)@fsep()@GetVar(MEMORYSTATUSEX.ullAvailPageFile)@fsep()@GetVar(MEMORYSTATUSEX.ullTotalVirtual)@fsep()@GetVar(MEMORYSTATUSEX.ullAvailVirtual)
Exit %R


I offered Garrett this code along time ago but I guess he forgot Wink

Remember however doing this forces Windows to push all tasks out to the page file.

_________________
Home of

Give VDS a new purpose!


Last edited by vdsalchemist on Mon Feb 04, 2008 3:25 pm; edited 2 times in total
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Sun Feb 03, 2008 7:13 am    Post subject: Reply with quote

Dave®
Nice try but is not working it fills only about 1 to 2MB of RAM...

What about more than one LIST...

After working closely with Dred he provided me RAM support support over 2GB... Smile
http://www.dread.dk/

Pristy Utils 1.0.4 (next version will have updated full RAM support)
http://www.softpedia.com/get/System/System-Miscellaneous/Pristy-Utils.shtml

dragonsphere
Insufficient memory operation to line 58
and you are not getting full ram properly
Vista 32bit +4GB RAM = 3323MB
Vista 64bit +4GB RAM = 4096MB
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Feb 04, 2008 2:07 pm    Post subject: Reply with quote

filip wrote:

dragonsphere
Insufficient memory operation to line 58
and you are not getting full ram properly
Vista 32bit +4GB RAM = 3323MB
Vista 64bit +4GB RAM = 4096MB


To be honest with you Filip the amount of memory your OS can see is dependent on the version of Windows. Also you have to remember that VDS and the DLL's that support VDS are only 32bit therefore they will only see 32bit RAM space. My code works just fine on a 32bit OS however without knowing the exact version of Windows you are using I would not know exactly how to manage it. Also you don't need to allocate the full amount of memory only the available to cause Windows to free it up. This was a little trick used in Windows prior to Vista. If you are using Vista who knows what will happen if you try this? Also my code is using the Win32 API to return the amount of ram on your PC therefore it is not my code that is giving the information it is your OS that is returning the information. Also the Win32 API does not give the amount the way your displaying it here it only shows the numbers in bytes and how you came up with these numbers I would not know? Exact figures for RAM is speculative when converting from BYTEs to KiloBytes to MegaBytes to GigaBytes. It's not exact and not all RAM manufactures build their RAM exact to the specifications of the Software that use it.

Also there is something else you need too look at if my code says "Insufficient Memory". Are you sure your SwapFile is working properly and is not fragmented because I have used all the memory on my PC to the Point that Windows XP said it had to expand my SwapFile while I was loading 1 gig files with my Dictionary command on a box that only had 1 gig of Ram but never have I seen Windows refuse to allocate memory before unless the Application was trying to use more Ram than the OS allows of a single process and depending on which version of Windows you have a single process may only be able to allocate 2GB even if you have 4GB of RAM.

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Mon Feb 04, 2008 3:20 pm    Post subject: Reply with quote

Filip,
Sorry the code that I posted before was older code that I wrote for Garrett before Window XP was released. I have updated it to use the Ex version of the GlobalMemoryStatus function called GlobalMemoryStatusEx which should be what Dr. Dread is using with his DisknMem.dll.... My code should show the correct information now. Again sorry for the confusion Confused

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Tue Feb 05, 2008 5:24 am    Post subject: Reply with quote

OK ...is there any workaround fix to fill more than 2GB of RAM...
Back to top
View user's profile Send private message Send e-mail
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1565

PostPosted: Tue Feb 05, 2008 4:06 pm    Post subject: Reply with quote

Each application on a 32 bit operating system can only address/use 2 gb. There is a flag you can use when compiling an exe ({$SetPEFlags $20} - but cannot be used in vds as theres no way to specify compile flags) that allows you to address 3gb of ram per application.
Back to top
View user's profile Send private message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Feb 05, 2008 9:14 pm    Post subject: Reply with quote

would creating a secondary exe as a slave to do this work?

You have your main exe which does pretty much everything else, but
then have a secondary exe which is bin/hex'd into your main exe, and
when you need it, save it out, or save out 2 of them under new names
and run them from your main exe. Each one would have 2gb capability.
Or if you require more, save out 3 or 4, giving each a new name such
as memslave1.exe etc.

When each is done, delete them.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
filip
Valued Contributor
Valued Contributor


Joined: 07 Aug 2004
Posts: 340

PostPosted: Wed Feb 06, 2008 6:09 am    Post subject: Reply with quote

Double RAM clean i was thinking in this direction but prolems is how to get the correct info back...and when to run this the same time later on...?
Back to top
View user's profile Send private message Send e-mail
vdsalchemist
Admin Team


Joined: 23 Oct 2001
Posts: 1448
Location: Florida, USA

PostPosted: Wed Feb 06, 2008 1:37 pm    Post subject: Reply with quote

Garrett wrote:
would creating a secondary exe as a slave to do this work?

You have your main exe which does pretty much everything else, but
then have a secondary exe which is bin/hex'd into your main exe, and
when you need it, save it out, or save out 2 of them under new names
and run them from your main exe. Each one would have 2gb capability.
Or if you require more, save out 3 or 4, giving each a new name such
as memslave1.exe etc.

When each is done, delete them.


This would work just fine. If you have 4GB of ram have 2 programs running and split the RAM between them. You could actually run multiple instances of the same program pass the amount of ram that instance should allocate on the command line. If you have more than 4GB such as some extreme game machines just divide out how many times the child instance should run. Also I did find that this trick works even if you just allocate the free memory however it does not free quite as much as it does when you try to allocate all memory.

Garrett I say you dust off your old MemTrax program and publish a new version Wink

_________________
Home of

Give VDS a new purpose!
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Wed Feb 06, 2008 8:51 pm    Post subject: Reply with quote

Memory-Trax used a VBScript to actually claim the memory back, but
it too had issues with larger amounts of memory. That, coupled with
the rash of virii at the time, such as "Melissa" and the "I Love You" virus
that were based on VBScript, totally killed Memory-Trax. Every
anti-virus program out there then labeled any VBScript as suspicious
and I began to get emails daily calling me foul names for trying to
infect their computers with a virus.

So not likely that I'll ever rehash it again. It enjoyed it's limelight for
a few years there, and I had fun doing it too.

It's funny though, you can still find Memory-Trax listed here and there.
But I've since had to drop the email address used at that time so no
longer get any feedback from any users at all.

The other thing is, that when I made that, there were a lot 95+ boxes
out there still in use. This program was great for them, but XP and the
other NT variants did not need a memory reclaim program at all. So as
it stands now, in my eyes, a memory reclaim program really isn't
needed anymore and is merely a novelty item now. No insult intended
Filip, and please, do not drop your program because of my view here.

_________________
'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.)
Back to top
View user's profile Send private message
vtol
Valued Contributor
Valued Contributor


Joined: 05 Feb 2004
Posts: 656
Location: Eastern Indiana

PostPosted: Sun Feb 10, 2008 5:28 pm    Post subject: Reply with quote

Just some added info here.
Dr. Dreads DisknMem.dll does not read directory information under win98se I noticed.
Maybe he'll read this post and update his DisknMem.dll for win98se, or maybe its an API limitation with win98se. Cool
I can use VDSDLL with the DisknMem.dll, not a biggy, since both are old and not so much support.
Sorry if I interupted the main subject..
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group