[swift-users] Object size on heap

Howard Lovatt howard.lovatt at gmail.com
Wed Mar 23 17:59:19 CDT 2016


Thanks, I will give that a try

  -- Howard.

On 24 March 2016 at 03:17, Jens Alfke <jens at mooseyard.com> wrote:

>
> On Mar 22, 2016, at 11:04 PM, Howard Lovatt via swift-users <
> swift-users at swift.org> wrote:
>
> I am writing custom collection classes and trying to assess which one is
> better, both in terms of performance and memory usage. Won't be used in
> 'real' code, just to guide development.
>
>
> You might consider using heap profiling tools too, like (on Mac OS) the
> Instruments app or the `heap` command-line tool. If you use these while
> running a benchmark app using your API, it can show you how much total heap
> space gets used.
>
> Actual heap usage can differ from the raw “sizeof” a data type, since
> allocators will often round up block sizes or return a somewhat larger
> block than necessary. Heap fragmentation can also increase memory usage
> beyond what you’d expect, and different allocation patterns can affect
> fragmentation.
>
> —Jens
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160324/e8897a22/attachment.html>


More information about the swift-users mailing list