WIKI AllocSysObject ASO_NoTrack clarification

Have a question about our Software Developer Kit? Ask them here.
Post Reply
Posts: 1165
Joined: Sun Jun 19, 2011 12:06 am

WIKI AllocSysObject ASO_NoTrack clarification

Post by xenic »

The autodoc for AllocSysObject says this about the ASO_NoTrack option:
  • ASO_NoTrack: A boolean value that indicates
    whether the object should be tracked or not.

    This might be useful for stuff that is dangrous
    to get rid of automatically, like semaphores.
    Also, tracking has a slight additional memory overhead.
    Default: TRUE (i.e do not track)
That explanation is a little ambiguous to me. Is it useful to track or not track for things that are dangerous to get rid of automatically? Does this mean that selecting ASO_NoTrack TRUE would mean that memory allocated for the name of a semaphore that is copied by ASOT_SEMAPHORE ASOSYM_Copyname will not be tracked and freed automatically when FreeSysObject() is called? Also, why is it dangerous to get rid of a semaphore automatically?
AmigaOne X1000 with 2GB memory - OS4.1 FE

User avatar
AmigaOS Core Developer
AmigaOS Core Developer
Posts: 703
Joined: Tue Dec 21, 2010 9:25 pm
Location: New Zealand

Re: WIKI AllocSysObject ASO_NoTrack clarification

Post by Hans »


FreeSysObject() will always fully free an object (incl. memory). Tracking enables objects to be automatically cleaned up when a task/process ends. I assume that tracked objects are also automatically cleaned up after a task has been terminated due to crashing, but I'm not 100% sure.

Since semaphores are used for synchronization between multiple tasks, automatically freeing it when the task that created it stops could be risky. Other tasks that use that semaphore might try to access it after it's been freed.

I see tracking as a backup for when things go wrong, and believe that software should still manually free all objects before exiting. Not doing so is kind of lazy.

Hans - Amiga OS 4 projects, programming articles and more. Home of the RadeonHD driver for Amiga OS 4.x project.

Post Reply