C++ Memory Counting

Hello,

I have been working on an OpenCV project that uses the grand central dispatch pattern, libdispatch. I have asked at both the OpenCV forum and lisdispatch forum, but sources said that this is a more general C++ issue.

http://opencv.org/

http://opensource.mlba-team.de/xdispatch/docs/current/index.html

Anyway, i've made a neat little application that does image processing. Libdispatch has a series a of task queues that can recieve new data and perform a task.

What are the correct ways to count memory? Let's say we have 2 users each running a task queue. One user has paid to have 2Gb of RAM available to them at any one time. The other, has 4Gb. How can i count the memory between threads?

I am thinking along two lines... but, the issue arises of how to manage and control at this level with C++.

1) Do i mark each task type with some or of multiplier. i.e. Convertcolour uses X memory, and i want to convert and image. image size * cost per task.

2) Continually check how much memory has been allocated so far.

Basically i want to create a paid image processing service, that does not expand beyond the capacity that has been paid for.

Any clever ideas for this?

Regards,

Daniel

Visual Studio 2012
OpenCV
xDispatch
It's best to run the tasks as separate processes, then you can collect metrics or place limits on each process. Let the OS do what it does best. It's tricky to manage within one process.
First and foremost; charging by memory allocation is a terrible business model, RAM is cheap and you can't guarantee performance so there is next to zero QoS control on what is being paid for. The widely excepted model is to charge by processor core allocation and\or non-volatile storage.

Second, I agree with kbw 100%, you should let the OS handle this and not worry about coding it yourself. Specifically what he means is that memory quotas are set via group policy on a per user basis which is exactly what you are asking for here: http://technet.microsoft.com/en-us/library/dn221983(v=ws.10).aspx
Topic archived. No new replies allowed.