HP Forums

Full Version: Memory corruption issues with a certain integral.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Good evening.
I have created a tiny program to faster integrate over spherical, cylindrical etc. coordinate systems. The relevant part for this example is as follows:

// Vol.elem. vektoriell Sph. Koordinaten
function e_sp_vol(p_r,p_ϑ,p_φ)
local ret:= ABS(dot(cross(∂(v_r_sp(r,ϑ,φ),r),∂(v_r_sp(r,ϑ,φ),ϑ)),∂(v_r_sp(r,ϑ,φ),φ)));
return ret;
// Volumenintegral für ein Skalarfeld in Sph. Koordinaten
function int_sp(field,p_r,p_ra,p_rb,p_ϑ,p_ϑa,p_ϑb,p_φ,p_φa,p_φb)
local i_field;
local ret;
i_field := subst(field,p_r=ivar_r);
i_field := subst(i_field,p_ϑ=ivar_ϑ);
i_field := subst(i_field,p_φ=ivar_φ);
ret := ∫(∫(∫(i_field*e_sp_vol(ivar_r,ivar_ϑ,ivar_φ),ivar_φ,p_φa,p_φb),ivar_ϑ,p_ϑa,​p_ϑb),ivar_r,p_ra,p_rb);
return ret;

Basically this program takes the arguments and calculates the attached integral.

The problem is, when this function is executed for a couple of times, the CAS starts to misbehave and memory corruption seems to occur; sometimes the operating system simply crashes. The variable browser in HP Connectivity Kit shows seemingly empty variables with strange contents (see attached screen).

You may test this program by calling it with

It sould return the volume of a sphere as it does as long as the memory corruption is not severe enough.

When we restart the CAS, the purged variables look as attached in the screenshot.

Tell me if you have any ideas on what I am missing there.
Kind regards.

Information on the environment:
Prime G2
20210505 update (it was buggy before this version as well)
I think the only way to avoid strange behavior is to delete the "corrupted" variables from CAS memory (Shift + Memory -> Cas Vars, Delete) every time the integral is calculated.
The same thing happens to me too, when I calculate a "difficult" integral: I think that the HP PRIME calculator stores in Cas some "dummy" variables that lead to the resolution of the integral.
Unlikely to be due to lack of memory as its a G2, unless it's a leak or some other memory management issue?
Hopefully hp team can advise.
(05-13-2021 07:10 AM)Stevetuc Wrote: [ -> ]Unlikely to be due to lack of memory as its a G2, unless it's a leak or some other memory management issue?
Hopefully hp team can advise.

Out of memory issues should lead to an instant crash or not?
I never had such an occurrence.
Reference URL's