Re: Tracking down memory usage (leak?) in Pike program

Fredrik Hubinette <[email protected]>
Newsgroups gmane.comp.lang.pike.user
Message-ID <CAKab2FwXn0hFxKZm_e-3TZk5DzEeo9PKYEkO7pstzm_sYs+puQ@mail.gmail.com>
First thing might be to compare these values to a program that's been
running for an hour or so. You seem to have a very large number of objects,
is that normal?
Since I don't remember: Is malloc_bytes a subset of malloc_block_bytes, or
not?

Second thing would be to run everything through valgrind and see if it says
anything interesting.

You can also check the memory map with pmap(1) to see if maybe there are
some large mmaps or something using up memory.

      /Hubbe


On Tue, Jul 19, 2016 at 11:12 AM, Chris Angelico <[email protected]> wrote:

> I have a GUI Pike program that's been running for roughly a month, and
> according to top(1), its RSS is five gigabytes. How can I track down
> where that memory is being used?
>
> Debug.memory_usage() returns this, which has some large values in
> malloc stats, but not in array/object/string etc:
>
> ([ /* 50 elements */
>   "array_bytes": 60025888,
>   "ba_mixed_frame_bytes": 216,
>   "call_out_bytes": 27424,
>   "callable_bytes": 27896,
>   "callback_bytes": 4328,
>   "catch_context_bytes": 7488,
>   "compat_cb_box_bytes": 216,
>   "destroy_called_mark_bytes": 216,
>   "free_block_bytes": 173104,
>   "gc_rec_frame_bytes": 216,
>   "malloc_block_bytes": 1150509056,
>   "malloc_bytes": 1021242320,
>   "mapping_bytes": 85012815,
>   "marker_bytes": 216,
>   "mc_marker_bytes": 216,
>   "multiset_bytes": 114704,
>   "node_s_bytes": 216,
>   "num_arrays": 438612,
>   "num_ba_mixed_frames": 0,
>   "num_call_outs": 138,
>   "num_callables": 255,
>   "num_callbacks": 5,
>   "num_catch_contexts": 2,
>   "num_compat_cb_boxs": 0,
>   "num_destroy_called_marks": 0,
>   "num_free_blocks": 1,
>   "num_gc_rec_frames": 0,
>   "num_malloc": 24,
>   "num_malloc_blocks": 8,
>   "num_malloced_strings": 44288,
>   "num_mappings": 430246,
>   "num_markers": 0,
>   "num_mc_markers": 0,
>   "num_multisets": 143,
>   "num_node_ss": 0,
>   "num_objects": 2419654,
>   "num_pike_frames": 889,
>   "num_pike_list_nodes": 0,
>   "num_pike_types": 10616,
>   "num_programs": 2005,
>   "num_short_strings": 43544,
>   "num_static_strings": 1105,
>   "num_strings": 91353,
>   "num_substrings": 2416,
>   "object_bytes": 245704408,
>   "pike_frame_bytes": 114240,
>   "pike_list_node_bytes": 216,
>   "pike_type_bytes": 650568,
>   "program_bytes": 4258088,
>   "string_bytes": 11878328
> ])
>
> Any advice?
>
> ChrisA
>
>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.