Resources tracking

The system should be able to track all the resources used by a software module.

To achieve this goal, a Resource Collection is created and associated to a software module when it is loaded in memory; the memory and other resources used by the software module are added to the Resource Collection. A software module could create a separate Resource Collection to allow easier management and release of a group of tracked resources for a specific request or task performed.

This system would require that resource allocators such as the memory manager requires the caller to provide a Resource Collection as a parameter when requesting additional memory. Alternatively, the Resource Collection could be associated to a thread; the default Resource Collection would be the one of the parent thread at the moment the thread was created.

I suspect that associating a Resource Collection to the currently executing thread would be more efficient than passing it as argument to procedure calls;  this would avoid having to pass a parameter to each procedure call and save even more cycles as one resource allocator requires to call another resource allocator; chances are that a thread would use the same Resource Collection for successive resource allocations.

With this in mind, the following procedures should be available in the system to manage the Resource Collections:

  • Acquire Resource Collection
  • Set Resource Collection as Default
  • Release Resource Collection
  • List Content of Resource Collection