[Bf-committers] mallocn.c
Nathan Letwory
jesterking at letwory.net
Fri Feb 17 16:15:57 CET 2006
As a quick-fix it should work, but look at the threads about a win32
mmap-like implementation. That'd be a better solution to commit.
/Nathan
On Pe 17.2.2006 16:43, Johnny Matthews kirjoitti:
> I was getting an unresolved external for munmap on win32, I made this
> change and it seems to work. I don't know this code, so I did not want
> to commit it
>
> in mallocn.c
> ------------------old function-----------------
>
> static void rem_memblock(MemHead *memh)
> {
> remlink(membase,&memh->next);
> if (memh->prev){
> if (memh->next) MEMNEXT(memh->prev)->nextname =
> MEMNEXT(memh->next)->name;
> else MEMNEXT(memh->prev)->nextname = 0;
> }
>
> totblock--;
> mem_in_use -= memh->len;
>
> if(memh->mmap) {
> mmap_in_use -= memh->len;
> if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
> printf("Couldn't unmap memory %s\n", memh->name);
> }
> else
> free(memh);
> }
>
> -------------------new function -----------------------------
> static void rem_memblock(MemHead *memh)
> {
> remlink(membase,&memh->next);
> if (memh->prev){
> if (memh->next) MEMNEXT(memh->prev)->nextname =
> MEMNEXT(memh->next)->name;
> else MEMNEXT(memh->prev)->nextname = 0;
> }
>
> totblock--;
> mem_in_use -= memh->len;
>
> #if defined(AMIGA) || defined(__BeOS) || defined(WIN32)
> free(memh);
> #else
>
> if(memh->mmap) {
> mmap_in_use -= memh->len;
> if (munmap(memh, memh->len + sizeof(MemHead) + sizeof(MemTail)))
> printf("Couldn't unmap memory %s\n", memh->name);
> }
> else
> free(memh);
> #endif
> }
>
>
>
>
> is this correct?
>
> --
> Johnny Matthews
> johnny.matthews at gmail.com
>
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>
/Nathan
More information about the Bf-committers
mailing list