Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write a memory manager that maps 4 GB for Delphi

Tags:

delphi

I have an object that uses more than 2 gigabytes of virtual memory But Delphi only managers 2 GB I'm considering ether making a number of objects and grouping them and using the windows wow64 method some how and use 64 bit windows. Or just upgrading memory manager to 4 GB and build it around Int64. effectively I need TStream as the base object with Int64 used, instead of integers.

like image 620
lexdean Avatar asked Nov 29 '22 04:11

lexdean


2 Answers

Lexdean, you're saying:

effectively I need TStream as the base object with Int64 used, instead of integers

Well then, you're in luck (twice) because:

  1. Delphi's TStream uses Int64 for position, it can access files much larger then 4Gb.
  2. If a TStream interface is enough, you can write your own TStream to do whatever you want, you don't need to wait for an native 64bit Delphi compiler.

But if I were to answer the question in the title:

How to write a memory manager that maps 4 giggs for Delphi

There's no way to do that with an 32bit compiler. Join the crowd of people asking for an 64 bit Delphi compiler!

like image 187
Cosmin Prund Avatar answered Dec 22 '22 20:12

Cosmin Prund


Having a single 2 gigabyte object is not a good idea. If memory is fragmented you won't be able to allocate one even if the amount of free memory is enough. I would suggest that you try to use a list of smaller objects.

(I remember how in Turbo Pascal (the predecessor to Delphi) a variable couldn't be larger than 64 kilobyte... Oh, the times... ;)

like image 37
Guffa Avatar answered Dec 22 '22 21:12

Guffa