Size of array (new[])
问题 In debug heap I can get size of array, which was created by new[] : int size = *((int *)((char *)ptr - 16)); It is working correctly if the size of the array is less than 28 (but I don't know why? 0_0). Does this trick working in release mode (not using debug heap)? How I can get size of the array (100% working and stable)? 回答1: You are relying on an implementation detail. That's how your particular implementation stores the size of the memory region where the array is placed. As you already