GOOGLE ADS

sábado, 23 de abril de 2022

¿Cómo delete[] "sabe" el tamaño de la matriz de operandos?

Foo* set = new Foo[100];
//...
delete [] set;

No pasa los límites de la matriz a delete[]. Pero, ¿dónde se almacena esa información? ¿Está estandarizado?


Solución del problema

When you allocate memory on the heap, your allocator will keep track of how much memory you have allocated. This is usually stored in a "head" segment just before the memory that you get allocated. That way when it's time to free the memory, the de-allocator knows exactly how much memory to free.

No hay comentarios:

Publicar un comentario

Regla de Firestore para acceder a la generación de subcolección Permisos faltantes o insuficientes

Tengo problemas con las reglas de Firestore para permitir el acceso a algunos recursos en una subcolección. Tengo algunos requests document...