Find Jobs
Hire Freelancers

C++ Memory management Crash Issue

$30-100 USD

Cancelado
Publicado hace alrededor de 17 años

$30-100 USD

Pagado a la entrega
**I have a crash happening and I want step-by-step explanation as to why that is. e.g: **a) the list grows by ... ... b) the list exceeds at... ... c) crashes because... ... ## Deliverables 1) Step by step explanation of the why the crash is happening. e.g: a) the list grows by ... ... b) the list exceeds at... ... c) crashes because... ... 2) Provide the right fix. Modify the ArrayInsert function with the complete fix. 3) Will only accept the answer if it fixes the crash in my product when I copy over the modified ArrayInsert function. **Here is the code that is inserting elements into an array.** void*MyMem::ArrayInsert (void *ptr, void *element, USHORT elementSize, USHORT insertPoint, USHORT elementCount, USHORT allocCount) { unsigned int moveSize; unsigned int allocSize; ULONG elementsAlloced; char *src; char *dst; if (ptr == NULL) { allocSize = (unsigned int)elementSize * (unsigned int) allocCount; ptr = Alloc(allocSize); if (ptr == NULL) { return (NULL); } elementsAlloced = allocCount; } else { USHORT size = (USHORT) Util::MemGetSize (ptr); //returns unsigned int size memory elementsAlloced = (USHORT) (size / elementSize); } // if if (elementCount >= elementsAlloced) { elementsAlloced = elementsAlloced + allocCount; allocSize = (unsigned int)elementSize * (unsigned int) elementsAlloced; ptr = ReAlloc(ptr, allocSize); if (ptr == NULL) { return (NULL); } // if } // if src = (char *)ptr + ((SLONG)insertPoint * (SLONG)elementSize); dst = src + elementSize; moveSize = (unsigned int)elementSize * (elementCount-insertPoint); if (moveSize > 0) { memmove(dst, src, moveSize); } // if dst = src; memcpy(dst, element, elementSize); return (ptr); } // ArrayInsert **Here is the how this function is called:** ArrayInsert(void * ptr=0x00000000, void * element=0x0013bb10, unsigned short elementSize=16, unsigned short insertPoint=0, unsigned short elementCount=0, unsigned short allocCount=20) **However, when accessing this array, it crashes at index: 2041. Need explanation about the crash and fix for it. That's it.** ## Platform WIN XP. microsoft visual studio 2005. C++.
ID del proyecto: 2952561

Información sobre el proyecto

2 propuestas
Proyecto remoto
Activo hace 17 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
2 freelancers están ofertando un promedio de $7 USD por este trabajo
Avatar del usuario
See private message.
$4,25 USD en 1 día
5,0 (3 comentarios)
5,5
5,5
Avatar del usuario
See private message.
$10,20 USD en 1 día
5,0 (43 comentarios)
4,4
4,4

Sobre este cliente

Bandera de UNITED STATES
United States
0,0
0
Miembro desde may 3, 2007

Verificación del cliente

¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.