[ 
https://issues.apache.org/jira/browse/TS-4212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15155133#comment-15155133
 ] 

ASF GitHub Bot commented on TS-4212:
------------------------------------

Github user bryancall commented on a diff in the pull request:

    https://github.com/apache/trafficserver/pull/489#discussion_r53533502
  
    --- Diff: lib/ts/ink_memory.cc ---
    @@ -209,6 +210,46 @@ ats_mlock(caddr_t addr, size_t len)
       return res;
     }
     
    +void *
    +ats_track_malloc(size_t size, uint64_t *stat)
    +{
    +  // pad with 8 bytes to add allocation size
    +  void *ptr = malloc(size + 8);
    +  memcpy(ptr, &size, 8);
    +  ink_atomic_increment(stat, size);
    +  return (void *)((uint64_t)ptr + 8);
    +}
    --- End diff --
    
    I am planning on having and option for `ats_malloc` to call the track 
functions in the future. Still thinking about how to do it cleanly.


> Add option to track memory allocation with OpenSSL
> --------------------------------------------------
>
>                 Key: TS-4212
>                 URL: https://issues.apache.org/jira/browse/TS-4212
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: Core, SSL
>            Reporter: Bryan Call
>             Fix For: 6.2.0
>
>
> For example:
> {code}
> [bcall@l1 ~]$ sudo traffic_line -s proxy.config.res_track_memory -v 2
> [bcall@l1 ~]$ sudo kill -sigusr1 $(pidof traffic_server); tail traffic.out
> Total Allocated      | Total Freed          | Currently Allocated  | Type
> ---------------------|----------------------|----------------------|----------------------
>          18437960662 |          17181254510 |           1256706152 | SSL 
> Allocated Memory
> ---------------------|----------------------|----------------------|----------------------
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to