Traffic Server
  1. Traffic Server
  2. TS-577

Is SDKAllocator really necessary? Or can we at least minimize the amount of mallocs ?

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.5
    • Component/s: TS API
    • Labels:
      None

      Description

      The SDKAllocator is used to 'wrap' internal structures into handles, that does a couple of things:

      1) Validate that the object is of appropriate type before calling "release" on them (for example)

      2) it keeps a linked list of all allocated object on the header heap. When the header heap goes out of scope, anything remaining gets automatically released.

      #2 is, as far as I can tell, there for being backwards compatible with previous APIs (which we never supported). It also provides a means of lazy programming (or easy programming, depending on how you see it), where even if a plugin doesn't release resources properly, it still won't leak memory.

      Now, I'm still investigating, but I suspect we could get away from most of the allocations at all, and effectively eliminate the release requirements as well. But even so, I think there's plenty of improvements that can be done in this area, which will eliminate a significant amount of malloc()'s (since the SDKAllocator uses xmalloc and xfree liberally, with no pools).

      Comments in this area is much welcomed, since it might affect how our APIs will work in this area.

      1. TS-577.diff
        7 kB
        Leif Hedstrom

        Activity

        Hide
        Leif Hedstrom added a comment -

        Proposed changes, which replaced the SDKAllocator with a class allocator, and removes the "garbage collection" feature.

        Show
        Leif Hedstrom added a comment - Proposed changes, which replaced the SDKAllocator with a class allocator, and removes the "garbage collection" feature.

          People

          • Assignee:
            Leif Hedstrom
            Reporter:
            Leif Hedstrom
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development