|
Smith, Nelson wrote: > So what is the best way to clear previously used occurrances? Do I have to > loop through all of them clearing them one at at time? Yes. > Further debugging did prove that after using 8 occurs, then resetting the > MODS to use 1 byte, then starting over and reallocating one occurrance's > worth of memory at a time, on the fifth occurrance, I began picking up > previously loaded data. So, apparently, REALLOC does not clear the new > memory it is allocating. At least not if it has been used previously in the > same job? Correct, ALLOC and REALLOC do not initialize storage. BTW, I've argued elsewhere that perhaps dynamically allocated storage is a technique that's being used way to much. If you're dealing with a relatively small amount of data (say less that 10000 records), you're probably better off using static arrays or MODS's. On the other hand, if you're dealing with a potentially large amount of data, you're probably better off using a database file. Considering the complexity of dynamic storage allocation, and the potential for bugs, the other techniques are much easier to deal with, even if they might be a bit more wasteful of resources. (Then again, doing a lot of REALLOC's certainly can be quite wasteful!) Cheers! Hans
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.