Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Problem with getmem


This question is answered.


Permlink Replies: 6 - Last Post: Feb 16, 2017 3:14 PM Last Post By: Brandon Staggs
Guest
Problem with getmem
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2017 9:35 AM
Dear forum users.

I have a question regarding Getmem.

I work with Delphi XE8 on two computers:
- a notebook with 16G RAM,
- a desktop computer with 32 G RAM.

When I locate a large amount of memory (e.g. 10G RAM) using Getmem, it works somehow surprisingly:

- on a notebook when computer runs out of RAM it seems that it switches to disc -
it starts to work slowly, but after while I get the result

- on a desktop computer when it runs out of RAM it immediately reports
' Out of memory' and stops.

So actually it works better on a notebook which has less RAM than the desktop computer.

The question:
- is there a way to tell the program in Delphi how 'getmem' should work?
- or is it there a system setting to define how it should work?

Thanks for any help.
Andrej
Brandon Staggs

Posts: 683
Registered: 3/3/01
Re: Problem with getmem  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2017 9:49 AM   in response to: Guest in response to: Guest
"Andrej Mrvar" wrote on Wed, 15 Feb 2017 09:35:09 -0800:

So actually it works better on a notebook which has less RAM than the desktop computer.

You don't say anything about architecture. Are you using a 32-bit or
64-bit executable, and are the Windows versions both 64-bit? 64-bit
Windows should have no objection to giving a 64-bit process 10GB of
memory regardless of how much RAM you have, unless there is something
wrong with the way your page file is configured. As far as your
question goes, all you can really do is find out if you can get a
block as large as you are requesting by finding out if it is
available. You could start here:

http://stackoverflow.com/questions/2265309/find-largest-free-memory-block

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
Guest
Re: Problem with getmem
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2017 1:11 PM   in response to: Brandon Staggs in response to: Brandon Staggs
Thanks for your reply. Sorry, I should tell that:
both computers are running 64 bit Windows 10.

I think I found out what is the problem:
the desktop (newer) computer has two disks:
C: disk (fast SSD), but it has only 36 G free space
D: disk is ordinary old disk with a lot of space (e.g. 1000G)

Although I run my Delphi program on D: disk,
when available RAM is out, it tries to use C: disk instead.
And it goes out of free paging file space

Is there any way to tell the program to use D: disk instead of C: disk for paging files?

It was a mistake to buy a desktop computer with so little SSD disk ;(

Thanks.


You don't say anything about architecture. Are you using a 32-bit or
64-bit executable, and are the Windows versions both 64-bit? 64-bit
Windows should have no objection to giving a 64-bit process 10GB of
memory regardless of how much RAM you have, unless there is something
wrong with the way your page file is configured. As far as your
question goes, all you can really do is find out if you can get a
block as large as you are requesting by finding out if it is
available. You could start here:

http://stackoverflow.com/questions/2265309/find-largest-free-memory-block

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: Problem with getmem
Correct
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2017 1:58 PM   in response to: Guest in response to: Guest
Andrej wrote:

the desktop (newer) computer has two disks:
C: disk (fast SSD), but it has only 36 G free space
D: disk is ordinary old disk with a lot of space (e.g. 1000G)

Although I run my Delphi program on D: disk,
when available RAM is out, it tries to use C: disk instead.
And it goes out of free paging file space

Is there any way to tell the program to use D: disk instead
of C: disk for paging files?

No, because that happens inside the OS itself, not inside your Delphi app.
Delphi simply asks the OS for a block of memory, it doesn't care where the
memory actually comes from. The OS decides that transparently. In your
case, the OS is getting memory from a page file that is located on the same
drive that the OS itself is installed on. This has nothing to do with the
drive that your app is running from.

See the following articles for more details:

RAM, virtual memory, pagefile, and memory management in Windows
https://support.microsoft.com/en-us/help/2160852/

Page File – The definitive guide
https://blogs.technet.microsoft.com/motiba/2015/10/15/page-file-the-definitive-guide/

Changing the Location of the Pagefile
https://msdn.microsoft.com/en-us/library/ms912851.aspx

how to relocate Pagefile.sys to another drive letter
https://social.technet.microsoft.com/Forums/office/en-US/19d96eb1-669c-4605-8d63-7337f1c09084/

What exactly is the negative impact of placing page file on SSD?
http://superuser.com/questions/1085806/

--
Remy Lebeau (TeamB)
b.a.v@inbox.ru
Re: Problem with getmem
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2017 6:37 PM   in response to: Guest in response to: Guest
Andrej Mrvar wrote:

Is there any way to tell the program to use D: disk instead of C:
disk for paging files?

No, change settings of paging file. On Win7 it is (in reverse
translation from Russian)

MyComp->Props->Additional params->Performance->Additional
params->Virtual memory "Change..." button

Add secondary paging file on drive D:

--
Alex
Guest
Re: Problem with getmem
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 15, 2017 11:18 PM   in response to: b.a.v@inbox.ru in response to: b.a.v@inbox.ru
Thank you both.
Finally I managed to solve the problem using the following steps:
1.Run sysdm.cpl
2.Go to Advanced
3.Select Settings under Performance
4.Go to Advanced (again)
5.Select Change under Virtual Memory
and I select the other drive (D:) to have system managed virtual memory as well
(before D: was not used as possible place to save a pagefile.
Problem solved ;)
Andrej
Brandon Staggs

Posts: 683
Registered: 3/3/01
Re: Problem with getmem  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 16, 2017 3:14 PM   in response to: Guest in response to: Guest
"Andrej Mrvar" wrote on Wed, 15 Feb 2017 13:11:51 -0800:

Is there any way to tell the program to use D: disk instead of C: disk for paging files?

I hope not. I wouldn't want any application to be able to override my
operating system's page file settings and operations.

If this is your computer, I would suggest correcting the underlying
issue, not trying to code around it.

--
Brandon Staggs
StudyLamp Software LLC
http://www.studylamp.com
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02