Memory
-
I would strongly suggest that if you don't understand what memory pages are and how they work, then you should just let windows handle the virtual memory. It is very easy to screw it up, and is not recommended while you're still trying to learn the basics. Dave http://www.cloudsofheaven.org
Thank you for your reply. I would have let windows handle everything in normal situations, but I am currently working on a program that needs full processor power and enough RAM to use as a buffer. I had a problem with the buffer size though, so I thought it would be adequate to ask the system how much free RAM it has and then allocate most of it. I certainly need to make sure that my buffer does not go into virtual memory, because that would buffer something from the HDD to the HDD, right? That said, I want to learn the new concepts I neaded, so please give me a link or a hint where to find the information I need. By the way, could you please tell me how to give my process higher priority? Thank you very much.
Hosam Aly Mahmoud
-
Thank you for your reply. I would have let windows handle everything in normal situations, but I am currently working on a program that needs full processor power and enough RAM to use as a buffer. I had a problem with the buffer size though, so I thought it would be adequate to ask the system how much free RAM it has and then allocate most of it. I certainly need to make sure that my buffer does not go into virtual memory, because that would buffer something from the HDD to the HDD, right? That said, I want to learn the new concepts I neaded, so please give me a link or a hint where to find the information I need. By the way, could you please tell me how to give my process higher priority? Thank you very much.
Hosam Aly Mahmoud
I have no clue how big a buffer you are allocating but I just wanted to inform you for all practical purposes on a 32 bit version of Windows that is not advanced server or greater you can not allocate a buffer greater than about 1.2GB because of several reasons that have to do with how process memory is partitioned. John
-
Thank you very much. The
GlobalMemoryStatus()
is great. But I could not understandVirtualLock()
. Could you kindly help me with it?Hosam Aly Mahmoud
I'll see what I can find. Here is an article that better describes what VirtualLock does. http://www.privacy.nb.ca/cryptography/archives/coderpunks/new/1999-02/0160.html[^] [EDIT] Here is an old link that shows a few examples of using virtual memory functions: http://www.labri.fr/Perso/~betrema/winnt/virtmm.html[^] [/EDIT] John
-
Thank you for your reply. I would have let windows handle everything in normal situations, but I am currently working on a program that needs full processor power and enough RAM to use as a buffer. I had a problem with the buffer size though, so I thought it would be adequate to ask the system how much free RAM it has and then allocate most of it. I certainly need to make sure that my buffer does not go into virtual memory, because that would buffer something from the HDD to the HDD, right? That said, I want to learn the new concepts I neaded, so please give me a link or a hint where to find the information I need. By the way, could you please tell me how to give my process higher priority? Thank you very much.
Hosam Aly Mahmoud
Here is a good tutorial about Memory Management, it’s a little old and mentions 16 bit windows and RISC stuff that you should not be very concerned with: http://www.jps.at/dev/kurs/3-2.html[^] John
-
I'll see what I can find. Here is an article that better describes what VirtualLock does. http://www.privacy.nb.ca/cryptography/archives/coderpunks/new/1999-02/0160.html[^] [EDIT] Here is an old link that shows a few examples of using virtual memory functions: http://www.labri.fr/Perso/~betrema/winnt/virtmm.html[^] [/EDIT] John
Thank you for your reply, and sorry for my late reply. I read the two links, and thanks a lot for the second one. The first one, however, made me rethink about using
VirtualLock()
. But I think that if my application does not lose focus, then it will keep my application fast. Is that right? Now I have another problem: how can I keep my application in the foreground? Should I make my process' priority "Real Time"? How can I do that? Thank you very much.Hosam Aly Mahmoud
-
I have no clue how big a buffer you are allocating but I just wanted to inform you for all practical purposes on a 32 bit version of Windows that is not advanced server or greater you can not allocate a buffer greater than about 1.2GB because of several reasons that have to do with how process memory is partitioned. John
Thank you for the information.
Hosam Aly Mahmoud
-
Thank you for your reply, and sorry for my late reply. I read the two links, and thanks a lot for the second one. The first one, however, made me rethink about using
VirtualLock()
. But I think that if my application does not lose focus, then it will keep my application fast. Is that right? Now I have another problem: how can I keep my application in the foreground? Should I make my process' priority "Real Time"? How can I do that? Thank you very much.Hosam Aly Mahmoud
Hosam Aly Mahmoud wrote: But I think that if my application does not lose focus, then it will keep my application fast. Yes it will. As long as the application is not minimized it will not page out unless another process needs memory. When the application is minimized windows sets the working set size to zero thus paging out your application. Different windows versions will handle this alittle differently. I think NT4 will page all of your applicaton out immediatly causing a long delay. I am a little unsure of this. I worked on this two years ago for an application that needed to hold 256MB of images in memory at a time. Hosam Aly Mahmoud wrote: how can I keep my application in the foreground? Don't allow the main window to be minimized. I made the minimize button hide the window instead of minimize and it fixed the problem. John
-
Hosam Aly Mahmoud wrote: But I think that if my application does not lose focus, then it will keep my application fast. Yes it will. As long as the application is not minimized it will not page out unless another process needs memory. When the application is minimized windows sets the working set size to zero thus paging out your application. Different windows versions will handle this alittle differently. I think NT4 will page all of your applicaton out immediatly causing a long delay. I am a little unsure of this. I worked on this two years ago for an application that needed to hold 256MB of images in memory at a time. Hosam Aly Mahmoud wrote: how can I keep my application in the foreground? Don't allow the main window to be minimized. I made the minimize button hide the window instead of minimize and it fixed the problem. John
Thanks for your efforts and time. John M. Drescher wrote: I made the minimize button hide the window instead of minimize and it fixed the problem I think I will disable the minimize button. That should be enough. John M. Drescher wrote: As long as the application is not minimized it will not page out unless another process needs memory. So what if another process does need memory? How can I delay all other processes and make them wait until I am finished?
Hosam Aly Mahmoud
-
Thanks for your efforts and time. John M. Drescher wrote: I made the minimize button hide the window instead of minimize and it fixed the problem I think I will disable the minimize button. That should be enough. John M. Drescher wrote: As long as the application is not minimized it will not page out unless another process needs memory. So what if another process does need memory? How can I delay all other processes and make them wait until I am finished?
Hosam Aly Mahmoud
Hosam Aly Mahmoud wrote: So what if another process does need memory? How can I delay all other processes and make them wait until I am finished? If another process needs memory it may affect the working set of your process. When all the physical memory of the system is exausted the cpu will trim the working set of all processes (other than the one requesting additional memory). Hosam Aly Mahmoud wrote: How can I delay all other processes and make them wait until I am finished? Maybe setting the process priority to real time may solve your problem. John
-
Hosam Aly Mahmoud wrote: So what if another process does need memory? How can I delay all other processes and make them wait until I am finished? If another process needs memory it may affect the working set of your process. When all the physical memory of the system is exausted the cpu will trim the working set of all processes (other than the one requesting additional memory). Hosam Aly Mahmoud wrote: How can I delay all other processes and make them wait until I am finished? Maybe setting the process priority to real time may solve your problem. John
Thank you very much for your help John! I do not know how I could thank you, but here is a try: :rose: :) John M. Drescher wrote: Maybe setting the process priority to real time may solve your problem. I thought it would, but I do not know how to do it. Could you please tell me (or give me a link)? I would very much appreciate it. Thank you for all your help!
Hosam Aly Mahmoud