At 4:38 PM -0800 3/3/99, Mike Pellegrino wrote:
>>all the handles, but you're on top of that. One 2.0 devices with multiple
>>heaps, it's possible that heap compaction and balancing could move a
>>record, which would invalidate your handle.
>I wasn't aware of this. It may effect my lookup on older devices.
>Fortunately, I store some extra data in my block headers which will help
>me if I do need to modify my code here. And I store the record indexes
>with the handles (which are needed to delete pages), so I think a minor
>mod will fix this.
Actually, you probably don't have to worry about it. ...Vitaly sent this to me privately, but I should pass it on. He says: "The automatic move between heaps (on 1.x and 2.x) can only happen if the database is closed. As long as the database is still open, the heap re-shuffler will leave it alone. Of course, a record/resource handle could change if his app tries to resize it, and there is not enough room in its current heap, in which case the record/resource will be moved to a nother heap and the resize API will return a new handle."
Another thought, if you don't want to mess with all this database overhead, you could use DmNewHandle instead of DmNewRecord. DmNewHandle allocates storage heap chunks that aren't attached to any database (until you attach them yourself.) It's very slightly faster, because there's no array insertion into any database index, and another added benefit is that these chunks get "automatically" deleted by the data manager when the device is reset, so you don't have to worry about cleanup code or leaks if some app crashes the machine.
--Bob
- RE: More memory problems..... Steve Patt
- Re: More memory problems..... Danko Radic
- RE: More memory problems..... Paul Todd
- RE: More memory problems..... Mike Pellegrino
- RE: More memory problems..... Alan Pinstein
- RE: More memory problems..... Bob Ebert
- RE: More memory problems..... Bob Ebert
- RE: More memory problems..... Mike Pellegrino
- RE: More memory problems..... Bob Ebert
- RE: More memory problems..... Mike Pellegrino
- RE: More memory problems..... Bob Ebert
- RE: More memory problems..... Mike Pellegrino
