Well, Steve, I do appreciate your greater experience in worming out the
secrets of where resources go to in Poplog. But what is hidden in procedures
(apart from manifest things like frozvals, updaters)? -datasize- presumably
gives the amount of code. Problems seem to be:
(i) Getting hold of file-lexicals.
(ii) Internal structure of procedures.
(iii) Devices are opaque
(iv) Processes and most of the call-stack are opaque.
(v) XptDescriptors are opaque.
(vi) External pointers are opaque.
Whether the limited tool below is of any use I don't know. It would help me,
since I memoise functions and forget about them... But would not help
X-related leaks.
-----------------------------------------------------------------------------
Example of use
: profile_store(200);
vedupperfile 720
emacsescapetable 817
vedbufferlist 76441
sysstring 512
vveddump 5184
----------------------------------------------------------------------------
/*
This runs on Poplog 14.0 without datasize.
Call profile_store(n) to obtain a listing of words whose dependent store is
larger than n words.
*/
section profile => profile_store;
vars procedure(
marked = newassoc([]),
profile_word,
size_profile,
is_profilable
);
define profile_store(n);
lvars n;
newassoc([]) -> marked;
appdic(profile_word(%n%));
enddefine;
define profile_word(W,n); lvars n,W;
unless W == "marked_profile" or not(isdefined(W))
then lvars V = valof(W), n1 = size_profile(V);
if n1>n then pr(W); sp(2); npr(n1);
endif;
endunless
enddefine;
define size_profile(V);
lvars V; ;;; V -> VV;
if iscompound(V) and isinheap(V) and not(marked(V))
and is_profilable(V)
then
true -> marked(V);
lvars n = datalength(V);
appdata(V, procedure(d); size_profile(d)+n->n endprocedure);
n
else 0
endif;
enddefine;
define is_profilable(V); lvars V;
not(
isprocedure(V) or isdevice(V) or isprocess(V)
or isexternal_ptr(V) or isXptDescriptor(V)
)
enddefine;
endsection
Robin
|