Hello,
I would need an advise. I have a main program which uses my module. From the main program, from its INTEGER, EXTERNAL function are called a subroutine and a plot function (both located in the MODULE).
The subroutine in the module reads (after its invoking from the main program by pressing a plotting button) two files to determine the number of lines in each file (it means, the numbers of the lines of both files are not known in advance) and then reads all necessary data in each of their lines for plotting.
I used the ALLOCATABLE statement in the module header and then , after reading in lines of both files (each separately, so there are two different number of lines) I placed the command
ALLOCATE (variables ) ! coming from a file
I did NOT use the DEALLOCATE command at the end of the subroutine and the plotting function which is invoked from the externaL function of the main program immediately after the invoked subroutine completes its task plots the data correctly. BUT ONLY for the first time! (see picture below):
When I leave the plot and I press immediately again the graph button from the main program (which should do the same tasks as described above), I always get the following run-time error:
So, I tried to use the DEALLOCATE command at the end of the subroutine, but in such case - even after FIRST pressing of the graphic button in the main program I get either the following run-time error (so, no graphs is plotted):
or - sometimes (very randomly and seldom) - something like stack overflow (currently I am unable to catch this run-time error).
NOTE: Currently, there are about 9000 points in one graph and about 7000 points in the second one.
What is wrong in the code with ALLOCATABLE/DEALLOCATABLE?
Thanks!
Martin




