- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
A nice module that you can use with ParallelHashList...
Description:
Why the 2 GB limitation on the Win 32bits systems ?
My AWE object pascal module is here, it allows your application
to use up to 64GB of RAM.
And here is the public interface of TAWEStorage class,
i have implemented the follow methods:
TAWEStorage = class(TObject)
public
Size:longword;
position:longword;
PageSize:integer;
constructor Create();
destructor Destroy(); override;
function GetMem(ulBytes: ULONG): BOOL;
function FreeMem(): BOOL;
function HowManyPagesAllocated(): ULONG;
function CopyFrom(in_stream:TMemoryStream;count:longint):longint;
function CopyTo(out_stream:TMemoryStream;count:longint):longint;
function Read(var Buffer;count:longint):longint;
function Write(const Buffer;count:longint):longint;
function ToString:string;
end;
Note: To be able to use AWE you have to set the user rights
correctly,
so,go to: Control Panel -> Administrative tools -> Local Security
Policy
-> User Rights Assignment and give 'Lock pages in memory' right
to the user that wants to use AWE.
Every TAWStorage object can go up to 4GB , and you can go up to
64GB !
You can download my AWE module from:
http://pages.videotron.com/aminer/
TAWEStorage is very easy to use, here is an example:
-------------------------------------------------
program test;
uses AWE,classes;
var
awe1:TAWEStorage;
ptr:pointer;
fstream1:TFileStream;
stream1,stream2:TMemoryStream;
Function StringToStream(const AString: string): TMemoryStream;
begin
Result := TMemoryStream(TStringStream.Create(AString));
end;
begin
stream2:=TMemoryStream.create;
fstream1:=TFileStream.create('test.txt',fmCreate);
stream1:=StringToStream('Hello world !');
awe1:=TAWEStorage.create;
writeln;
if awe1.getmem(stream1.size)
then writeln('Memory was reserved...')
else writeln('Memory was not reserved...');
writeln('Number of pages allocatd is: ',awe1.HowManyPagesAllocated);
if awe1.CopyFrom(stream1,stream1.size) <> 0
then writeln('CopyFrom ok ...')
else writelN('CopyFrom not ok ..');
awe1.position:=0;
awe1.CopyTo(stream2,awe1.size);
stream2.position:=0;
fstream1.copyfrom(stream2,stream2.size);
stream2.position:=0;
fstream1.position:=0;
writeln(awe1.tostring);
awe1.freemem;
awe1.free;
end.
--------------------------------------------------------------
Sincerely,
Amine Moulay Ramdane.
Link Copied
![](/skins/images/45C6C2D737ED71F4C51F0145C8CB1E9C/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page