Post Reply 
Memory corruption issues with a certain integral.
05-13-2021, 01:39 AM (This post was last modified: 05-13-2021 01:52 AM by t_angenbrandt.)
Post: #1
Memory corruption issues with a certain integral.
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:
Code:

#cas
// 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,ϑ,φ),φ)));
ret:=subst(ret,r=p_r);
ret:=subst(ret,ϑ=p_ϑ);
ret:=subst(ret,φ=p_φ);
return ret;
END;
// 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);
ret:=subst(ret,ivar_r=p_r);
ret:=subst(ret,ivar_ϑ=p_ϑ);
ret:=subst(ret,ivar_φ=p_φ);
return ret;
END;
#end

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
Code:

int_sp(1,a,0,r,b,0,π,c,0,2*π)
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)


Attached File(s) Thumbnail(s)
           
Find all posts by this user
Quote this message in a reply
05-13-2021, 03:57 AM
Post: #2
RE: Memory corruption issues with a certain integral.
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.
Find all posts by this user
Quote this message in a reply
05-13-2021, 07:10 AM
Post: #3
RE: Memory corruption issues with a certain 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.
Find all posts by this user
Quote this message in a reply
05-13-2021, 07:57 AM (This post was last modified: 05-13-2021 08:35 AM by t_angenbrandt.)
Post: #4
RE: Memory corruption issues with a certain integral.
(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.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)