http://www.aros.orgAROS-ExecAROS-Exec ArchivesPower2People

Menu principal

English

Česky

Deutsch

Ελληυικά

Français

Italiano

Nederlands

Polski

Português

Русский

Español

Suomi

Svenska


News

Archive

Introduction

Status
Copies d'écran
Ports
License

Téléchargement


Documentation

Utilisateurs
Installation
Utilisation
Commandes Shell
Applications
FAQ
Développeurs
Contributions
Roadmap
Bug Tracker
Travailler avec Subversion
Compilation
Manuel de développement d'applications
Manuel de développement de Zune
Manuel de developpement du système
Manuel de Debogage
Référence
Spécifications
UI Style Guide
Documentation
Porting
Traduction
Résumés
Liens

Contact

Mailing lists
IRC channels

Crédits

Acknowledgements


Images

Développeurs
Développeurs ensemble

Sponsors

Référencement

Liens

Get AROS Research Operating System at SourceForge.net. Fast, secure and Free Open Source software downloads

AROS Application Development Manual

Index

Avis

This document is not finished! It is highly likely that many parts are out-of-date, contain incorrect information or are simply missing altogether. If you want to help rectify this, please contact us.

Resource Tracking (RT)

Everyone talks about RT but what's it anyway? RT means three things:

  1. The OS takes notes about allocated resources (eg. memory, windows, libraries, devices, screens, etc).
  2. The OS checks the usage of those resources (ie. Did you open that window you want to render into? Is it still open? Is that a window anyway?)
  3. The OS closes resources if they are no longer used (either because your program crashed or because it exited without freeing them).

The current implementation can do all three things but to enable it, you must make some modifications to your code. The only disadvantage of the current implementation is that the resources won't be freed if the program crashes.

  1. Add the following lines to your code. It should be the first thing seen by the compiler:

    #define ENABLE_RT  1
    

    If you replace the 1 by 0, then RT will be silently disabled.

  2. Add #include <aros/rt.h> after the last include from proto/

  3. Add RT_Init(); as the first command in main().

  4. Call RT_Exit() before you terminate your program.

  5. Recompile.

The advantages are that you will get errors if you try to access resources which you didn't allocate and that you will get a list of resources which you didn't free at the end of your program. All messages will contain the position in the code where the error happened (if available) and the position in the code where the resource was allocated (this is the reason why RT has to be compiled in. It could be built into the OS, too, but it would be hard to gather the information where an error occurred).

A good example about how to use RT and what it can do can be found in AROS/workbench/demos/rtdemo.c.

The following resources are tracked:

  • Memory in AllocMem(), FreeMem(),``AllocVec()`` and FreeVec()
  • MsgPorts in CreateMsgPort(), DeleteMsgPort(), CreatePort(), DeletePort() and PutMsg()
  • Files in Open(), Close(), Read() and Write(). Read() and Write() also check their buffers.
  • Windows in OpenWindow(), OpenWindowTags(), OpenWindowTagList(), CloseWindow(), WindowToFront(), WindowToBack()
  • Screens in OpenScreen(), OpenScreenTags(), OpenScreenTagList(), CloseScreen(), ScreenToFront(), ScreenToBack(). CloseScreen() also checks for open windows on the screen before closing.

Copyright © 1995-2009, L'équipe de développement AROS. Tous droits réservés.
Amiga®, AmigaOS®, Workbench et Intuition sont des marques de Amiga Inc. Les autres marques appartiennent à leur propritaires respectifs.