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
 t_angenbrandt Junior Member Posts: 12 Joined: Jun 2020
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)

 « Next Oldest | Next Newest »

 Messages In This Thread Memory corruption issues with a certain integral. - t_angenbrandt - 05-13-2021 01:39 AM RE: Memory corruption issues with a certain integral. - robmio - 05-13-2021, 03:57 AM RE: Memory corruption issues with a certain integral. - Stevetuc - 05-13-2021, 07:10 AM RE: Memory corruption issues with a certain integral. - t_angenbrandt - 05-13-2021, 07:57 AM

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