Return the amount of memory used by the sds string at object->ptr * for a string object. This includes internal fragmentation. */
| 53 | /* Return the amount of memory used by the sds string at object->ptr |
| 54 | * for a string object. This includes internal fragmentation. */ |
| 55 | size_t getStringObjectSdsUsedMemory(robj *o) { |
| 56 | serverAssertWithInfo(NULL,o,o->type == OBJ_STRING); |
| 57 | switch(o->encoding) { |
| 58 | case OBJ_ENCODING_RAW: return sdsZmallocSize((sds)ptrFromObj(o)); |
| 59 | case OBJ_ENCODING_EMBSTR: return zmalloc_size(allocPtrFromObj(o))-sizeof(robj); |
| 60 | default: return 0; /* Just integer encoding for now. */ |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /* Return the length of a string object. |
| 65 | * This does NOT includes internal fragmentation or sds unused space. */ |
no test coverage detected