[Bf-committers] mallocn.c / munmap

Erwin Coumans erwin at erwincoumans.com
Fri Feb 17 21:28:49 CET 2006


Win32 doesn't have munmap indeed, so I committed Johnny's workaround.
Someone else can work on a mmap-like implementation solution.

Thanks,
Erwin

----- Original Message ----- 
From: "Nathan Letwory" <jesterking at letwory.net>
To: "bf-blender developers" <bf-committers at projects.blender.org>
Sent: Friday, February 17, 2006 7:15 AM
Subject: Re: [Bf-committers] mallocn.c


> 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
> 
> _______________________________________________
> Bf-committers mailing list
> Bf-committers at projects.blender.org
> http://projects.blender.org/mailman/listinfo/bf-committers
>



More information about the Bf-committers mailing list