Running very large DTrace Scripts

DTrace scripts may reject to work when you try to run very large scripts with hundreds of enablings or thousands of actions.

Error message:

dtrace: failed to enable './myDtraceProbe.d'' : DIF program exceeds maximum program size

Reason: The current default size for DTrace is 256K. This may be to small for some probes.

Solution 1: Increase the default size in file /etc/system. You will require to have root privileges.

set dtrace:dtrace_dof_maxsize=0x800000

Reboot the system after the change.

Disclaimer: Changes to the /etc/system file change the behavior of the entire system. Consult your system administrator upfront!

Solution 2: Set the parameter dynamically with mdb (Solaris Modular Debugger)

# mdb -kw

Loading modules: [ ... ]
> dtrace_dof_maxsize/E
dtrace_dof_maxsize:
dtrace_dof_maxsize: 262144
> dtrace_dof_maxsize/Z 0t524288
dtrace_dof_maxsize: 0x40000 = 0x80000
> dtrace_dof_max_size/E
dtrace_dof_maxsize:
dtrace_dof_maxsize: 524288

Disclaimer: Work with mdb is the equivalent to open heart surgery on your Solaris system. Any change has direct and system wide impact. Consider to use a /etc/system entry (see solution 1) and a reboot instead of.