<< gc SYMSCI Toolbox isEqual >>

SYMSCI Toolbox >> SYMSCI Toolbox > heap

heap

number of allocated symbolic objects

Calling Sequence

n = heap()

Arguments

n

integer

Description

Returns the number n of all allocated symbolic objects.

Examples

// manual gc
gc(%f);

// status quo
heap()

// create a symbol
x = %(Sym("x"));

// is it allocated?
heap()

// create more symbols
y = %(Sym("y")); z = %(Sym("z"));

// what do you expect?
heap()

// switch to automatic gc ...
gc(%t)

// ... assigning x+2 to z does NOT change the number of
// allocated symbols, because ...
z: x+2;

// ... x+2 creates a value object, which gets deleted automatically,
// seeing is believing ...
heap()

// back to manual gc ...
gc(%f);

// ... assigning x+2 to z DOES change the number of
// allocated symbols, because ...
z: x+2;

// ... x+2 creates an value object, which gets NOT deleted automatically,
// seeing is believing ...
heap()

// perform manual gc
gc()

// what's left?
heap()

// ok, let's finally clean up ...
free(x); free(y); free(z);
clear x y z

// and we are back at? (cf. above)
heap()

See Also

Authors

Bibliography

SymEngine: C++ library for fast symbolic manipulation.


Report an issue
<< gc SYMSCI Toolbox isEqual >>