473,383 Members | 1,868 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

vc6 set process memory usage

How do I take for example 2gb RAM and allow only a specific process to use them?
Nov 24 '09 #1

✓ answered by donbock

Declaring a static memory allocation eliminates the possibility of malloc failing to give you the memory you asked for; instead, the program would fail to load if there wasn't enough memory. (Is that progress?)

There's another issue though. If your program needs to run quite often then perhaps you want to prevent its memory from being swapped out when some other process needs a lot of virtual memory. On the other hand, if your program accesses its memory often enough then that memory is least likely to be swapped out. I don't know what facilities Windows provides for controlling the swap algorithm.

4 2195
Banfa
9,065 Expert Mod 8TB
Create your own heap with HeapCreate and allocate your memory for yopur process form there.

This does rather beg the question why would you want to? No process can access data allocated to another process as the virtual memory maps are completely separate.
Nov 24 '09 #2
My program has to make another program run with a specific size of memory
since it can't be interruped.
Maybe i should inject the code for allocating memory to another process?
I know i should ask it as a seperate question but... How do you inject a code
to another process? or maybe VirtualAllocEx should do?
Nov 24 '09 #3
donbock
2,426 Expert 2GB
Declaring a static memory allocation eliminates the possibility of malloc failing to give you the memory you asked for; instead, the program would fail to load if there wasn't enough memory. (Is that progress?)

There's another issue though. If your program needs to run quite often then perhaps you want to prevent its memory from being swapped out when some other process needs a lot of virtual memory. On the other hand, if your program accesses its memory often enough then that memory is least likely to be swapped out. I don't know what facilities Windows provides for controlling the swap algorithm.
Nov 24 '09 #4
What actually i need to do is:
A program running, declaring variables and meanwhile,
I give the program alot of space to declare the variables and to work for declaring them and i save its state (variables) in a file every X seconds.
Nov 24 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ronen | last post by:
Hi All, I am running a client against a web application installed on a remote server written in C# which involve infragistics for GUI . The .NET framework I use is from version 1.1.4322 and we...
2
by: w2jin | last post by:
Hi All Some my SQL Server are experience high memory usage. 1. How can I detect which process which process cause the big memory usage and not released? 2. Which sql server components in...
0
by: Dirk Reske | last post by:
Hello, how can I get the memory and cpu usage of a Process? I get the process infos with Process proc = Process.GetProcessByID(...) which value is the Memory usage, I get in the windows Task...
3
by: MattC | last post by:
I have an ASP.NET app that is running at around 60MB for the w3wp.exe. This often jumps very quickly to 100/120 MB before shrinking again. It is also using around 250MB of virtual memory. Is...
2
by: Sidharth | last post by:
Hello, We are experiencing some issues with the aspnet_wp process on our live servers. The problems are intermittent and we cannot reproduce it on our dev and test servers. Currently around...
2
by: Mark Jacobs | last post by:
I'm having problems determining the memory usage of a process using the Process component. If I call Process.VirtualMemorySize.ToString I will get back a value that is nowhere near close to what...
35
by: Alex Martelli | last post by:
Having fixed a memory leak (not the leak of a Python reference, some other stuff I wasn't properly freeing in certain cases) in a C-coded extension I maintain, I need a way to test that the leak is...
3
by: Sehboo | last post by:
Hi, Is it possible that you can monitor your memory usage and kill some process when memory usage reaches 80% or so? I have an application which uses lot of memory and then system hangs, but...
22
by: Zen | last post by:
Hi, My production machine has 2G of memory, when aspnet_wp.exe goes up to about ~1.2G of memory usage, I start get out-of-memory exception. Other processes don't use as much memory and I added...
5
by: kimiraikkonen | last post by:
I made a very small (2 forms) application with VB.NET 2005 express and second form contains web-browser component and flash movie inside it. Everything OK but after i close the program via normal...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.