|
"Chevalier, Rick" wrote: > > Joe, > > I don't think it's as easy as it sounds to allocate the storage and pass > back the record read. I have tried this in some sub-procedures and ran into > a problem. When the sub-program ended the memory was released. The pointer > made it back to the calling program OK but the storage it pointed to didn't > contain the data I wanted. I had to pass the pointer into the sub-procedure > to make it work. > > Of course it could be I just wasn't doing something correctly with the > sub-procedure. > Rick, if you actually allocate storage (say using the ALLOC opcode), memory is not released when the subprocedure ends. The only time ALLOC'd storage might be released unexpectedly would be if the activation group it was allocated in was reclaimed (this would happen on exit for a *NEW program, but never for a procedure). You may have been passing back the address of a local variable in your procedure. That would behave the way you describe.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.