You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/02/19 23:47:18 UTC
[jira] [Commented] (TS-4212) Add option to track memory allocation
with OpenSSL
[ https://issues.apache.org/jira/browse/TS-4212?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15155051#comment-15155051 ]
ASF GitHub Bot commented on TS-4212:
------------------------------------
Github user PSUdaemon commented on a diff in the pull request:
https://github.com/apache/trafficserver/pull/489#discussion_r53529845
--- 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 know we only support 64 bit, but shouldn't we still use `sizeof()` and `uintptr_t`?
> 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)