Questions tagged [resource-management]
142 questions
1
vote
1 answer
Wrapping C functions in auto objects without code duplication
In C++03, when you were to wrap a bunch of C functions in a class to create an 'auto object', you had to customize the object to the type of functions it encapsulated. As an example, to wrap a windows file HANDLE, you needed to call CloseHandle() in…

MarkP
- 4,168
- 10
- 43
- 84
1
vote
1 answer
best way to store configurations
I'm implementing a configuration manager with full API, similar to the Windows registry.
I want it to be human readable, as in being able to open and edit it with a text editor.
I want it to be able to store any type of configuration information…

zeitue
- 1,674
- 2
- 20
- 45
1
vote
1 answer
How to ensure to close database connection in Ruby?
I am learning Ruby. I am trying to make a connection to MySQL db using mysql gem. One of my concern is connection closing.
How should I ensure the connection closing at unexpected situations such as exception throwing?

eonil
- 83,476
- 81
- 317
- 516
1
vote
5 answers
Static variable that will not be disposed
I have a static StreamWriter variable in my class:
private static StreamWriter streamWriter = CreateStreamWriter(pathToFile);
I am not closing this StreamWriter in my app since it needs to be open while the app is running.
If I start and stop this…

Barka
- 8,764
- 15
- 64
- 91
0
votes
2 answers
What is the best way to manage handing off of closeable resources in Scala?
I'm looking at the scala-arm library, prompted by this answer, and it looks great for managing resources in most contexts.
There's one context, though, that it doesn't, on first glance, appear to handle: that of "handing off" a resource to another…

Michael Ekstrand
- 28,379
- 9
- 61
- 93
0
votes
1 answer
Is there some standard way to explicitly close services and other resources?
For instance when using database connection, threading or IO streams (all what is required explicit closing/free up) is there some standard way of doing this? Perhaps by implementing some standard interface so Framework/class consumer would be able…

sll
- 61,540
- 22
- 104
- 156
0
votes
1 answer
Azure Resource: REST API returns empty response in Deployed Azure Function
Azure REST API return 200 code with an empty response in Deployed azure function.
{
"value": []
}
I am trying to get all resources from Azure API, API return all resources when debugging from local, But getting empty response when calling from…

vam
- 3
- 4
0
votes
0 answers
Game Engine - Object Management : Absolute Manager ( Only One ) vs Each Manager ( Managers by type )
I'm just make game engine this day.
But, I have some problem.
The problem is Object Managerment.
My project has Resource Manager that only has authority of creating, deleteing, accessing resource.
But, it needs many complex problem that Resource…

tot4766
- 1
0
votes
0 answers
Docker Container: how can the CPU usage percentage be above the total cores amount?
Here are the CPU usages of my containers. These values come from a historical collection of docker stats output. The VM I'm using has 8 cores and 32GB of ram.
container's CPU usage chart
As seen here…
0
votes
0 answers
CPU and Memory Stress in Kubernetes
I created a simple pod with resource limits. The expectation is that the pod gets evicted when it uses more memory than the limit specified. To test this, how do I artificially fill the pod memory? I can stress CPU with dd if=/dev/zero of=/dev/null,…

Vasu Youth
- 323
- 3
- 13
0
votes
0 answers
Azure API not returning all resources
When returning all disks within a subscription, I noticed that not all resources are listed. When comparing to the GUI I can see more resources than there are returned in my API call.
Does Azure 'Hide' resources from the API when created by certain…

Lars
- 1
- 1
0
votes
1 answer
c# How to properly pass HttpRequestMessage in and return HttpRequestMessage out of function without leaks
I'm trying to implement a rest api client in c#. I've created every requests roughly like so:
public async Task CallCreateJob()
{
HttpRequestMessage requestMessage =
new HttpRequestMessage(HttpMethod.Post, URL))
…

hasdrubal
- 1,024
- 14
- 30
0
votes
0 answers
What happens when a resource-managed variable is used outside of its scope?
I am working with the following snippet of tensorflow related code:
def train_step(emb, y_onehot, step):
with tf.GradientTape() as tape:
logits = model(emb, training=True)
assert model.trainable_variables
…

WestCoastProjects
- 58,982
- 91
- 316
- 560
0
votes
1 answer
Reduce resource usage of this JS program?
I wrote the following JS program, which i'm running from the command line using node.
//step one: create an array of remaining creatures
var remainingCreatures = [];
//some config variables:
var amt = 1000; //amount of creatues generated
var maxhlt…

TheDeveloperNextDoor
- 157
- 2
- 2
- 12
0
votes
0 answers
Class with IDisposable members/properties
TLDR:
Why Dispose should not be invoked IDisposable members in Finalize() method. (possibly with a null check before) except for performance reasons? (when the members are not shared.)
How can one make sure that IDisposable members free their…

Yuval K
- 301
- 2
- 11