Is it possible to use file to increase the memory available.
for example: if we ahve code need 1 GB RAM to be work is it possible to run it in a system with 512MB RAM and use a file to allocate the rest of the memory needed.
Is it possible to use file to increase the memory available.
for example: if we ahve code need 1 GB RAM to be work is it possible to run it in a system with 512MB RAM and use a file to allocate the rest of the memory needed.
Yes. There are 2 ways to look at it:
1. You do all your operations by reading / writing to file from your code. Instead of memory. I.e. you take care in your code to access file.
2. You overload all required operators (new, delete, *, [], ., ->, ...) such that they access file instead of memory. Then write your code using like you you would write normal code.
3. You allocate needed amount and let operating system deal with virtual memory.
Is it possible to use file to increase the memory available.
for example: if we ahve code need 1 GB RAM to be work is it possible to run it in a system with 512MB RAM and use a file to allocate the rest of the memory needed.
You can not increase the memory of a system using a file. In order to read the contents of a file within your program you have to draw the file into memory in the first place.
A particular machine has a fixed size memory. Without modifying hardware you can not change that.
Windows does this already.
You can not increase the memory of a system using a file.
It's called virtual memory. By paging blocks in and out of files, you can expand the perceived limitation of RAM at the cost of performance. Modern operating systems will typically do this already, but if you're on something like an embedded system without virtual memory, it's not especially difficult to write such a framework yourself in software.
It's called virtual memory.
Which is not physical. You can not increase the amount of data you stuff into 512MB RAM using a file. You can certainly make it appear that you have more memory at the expense of having that data offloaded to non-RAM locations but the two are not the same thing.
My interpretation of the OPs question is whether the actual amount of RAM can be increased using a file. Not whether virtual memory would make it appear that there was enough memory.
Which is not physical.
Thankfully, that wasn't a requirement of the original question. If it was, the OP could have heard our laughing over the internet.
My interpretation of the OPs question is whether the actual amount of RAM can be increased using a file.
No offense, but your interpretation is stupid. Think about it for a moment. Excluding any kind of virtual memory where the appearance of more memory is achieved, the only possible interpretation of the question is physically extending the amount of RAM at the hardware level exactly as if a larger chip were installed. In other words, pure magic.
The type of person who would be so confused about fundamental computing concepts to ask that question, if such a person exists at all, wouldn't be hanging out in a C++ forum.
No offense, but your interpretation is stupid
Offense taken.
You can not judge, by a question, the aptitude of the source - particularly over the internet.
at the hardware level
A point I addressed in my response.
if such a person exists at all
I assure you they do. More importantly, you've responded to them in the past.
In either case, the question was phased as if the OP wished to perform the operation programmatically - as if it wasn't already being done. From that standpoint my points are valid and, most certainly, not stupid.
For what it's worth, when there's an ambiguity and one can interpret a question as if the OP were either:
I prefer to assume #2 until proven otherwise. Clearly you follow the opposite approach.
Offense taken.
From that standpoint my points are valid and, most certainly, not stupid.
Not stupid but incorrect, I assure you it can be done programmaticaly how do you think virtual memory which "IS" what is being discussed was done in the first place.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.