File: set_malloc_debug.m

package info (click to toggle)
suitesparse 1%3A7.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 254,920 kB
  • sloc: ansic: 1,134,743; cpp: 46,133; makefile: 4,875; fortran: 2,087; java: 1,826; sh: 996; ruby: 725; python: 495; asm: 371; sed: 166; awk: 44
file content (33 lines) | stat: -rw-r--r-- 1,112 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function set_malloc_debug (mdebug, new_debug_state)
%SET_MALLOC_DEBUG Turn on/off malloc debugging and mark the log.txt 
%
% set_malloc_debug (mdebug, new_debug_state)
%
% If mdebug is false, then no malloc debugging is performed,
% and the global GraphBLAS_debug is just set to false, regardless
% of new_debug_state.
%
% If mdebug is true, then the global GraphBLAS_debug flag is set
% to new_debug_state, and this action is logged in the log.txt file.

if (mdebug)
    % with malloc debugging, but allow it to be switched on or off,
    % depending on the test
    if (new_debug_state)
        debug_on
        fprintf ('================[malloc debugging turned on]============\n') ;
        fp = fopen ('log.txt', 'a') ;
        fprintf (fp, '[malloc debugging turned on]\n') ;
        fclose (fp) ;
    else
        debug_off
        fprintf ('================[malloc debugging turned off]===========\n') ;
        fp = fopen ('log.txt', 'a') ;
        fprintf (fp, '[malloc debugging turned off]\n') ;
        fclose (fp) ;
    end
else
    % no malloc debugging; ignore new_debug_state
    debug_off
end