Managing Extended Data Memory Use

Extended data is limited to 16 kilobytes per entity. Because the extended data of an entity can be created and maintained by multiple applications, this can lead to problems when the size of the extended data approaches its limit. ObjectARX provides two functions, acdbXdSize() and acdbXdRoom(), to assist in managing the memory that extended data occupies. When acdbXdSize() is passed a result-buffer list of extended data, it returns the amount of memory (in bytes) that the data will occupy; when acdbXdRoom() is passed the name of an entity, it returns the remaining number of free bytes that can still be appended to the entity.

The acdbXdSize() function must read an extended data list, which can be large. Consequently, this function can be slow, so it is recommended that you don't call it frequently. A better approach is to use it (in conjunction with acdbXdRoom()) in an error handler. If a call to acdbEntMod() fails, you can use acdbXdSize() and acdbXdRoom() to find out whether the call failed because the entity ran out of extended data, and then take appropriate action if that is the reason for the failure.