Forum

faster malloc

Post tutorials on how to do certain tasks within game or engine code here.

Moderator: InsideQC Admins

faster malloc

Postby revelator » Mon Oct 18, 2010 4:34 am

utility library thats seen used in more and more engines nowadays.

look up my ftp ip in general in the mingw compiler thread and grab this nedmalloc.7z if you want to try it out.

upto 125% faster than msvc malloc.

uses the same methods as dlmalloc.

to use in your own engine add nedmalloc.h at the start of quakedef.h

then add this to the compiler defines REPLACE_SYSTEM_ALLOCATOR

and add nedmalloc.lib to libraries.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby dreadlorde » Mon Oct 18, 2010 4:40 pm

Ehh, include files shouldn't include other include files. It creates a dependency hell situation, and can make the c preprocessor take longer than necessary, as it would process the same header more than needed.

My 2 cents about that.
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby revelator » Tue Oct 19, 2010 4:37 am

actually for most purposes and intents thats what headers do "besides holding structs etc"

if the idea disgust you that much you can also include the nedmalloc.h header in any file that uses a malloc function but as you might soon discover that includes allmost 90% of the engine :lol:

quakedef.h is included by pretty much all the files in quake so if you put it there it will be globally accessible :) sort of a win-win situation.

btw the normal way of including nedmalloc is by including its source in whatever project you want to use it on. i just made it a library for convinience.
User avatar
revelator
 
Posts: 2567
Joined: Thu Jan 24, 2008 12:04 pm
Location: inside tha debugger

Postby dreadlorde » Tue Oct 19, 2010 12:37 pm

reckless wrote:if the idea disgust you that much you can also include the nedmalloc.h header in any file that uses a malloc function but as you might soon discover that includes allmost 90% of the engine :lol:
That's what I'm doing with my engine right now, I'm fixing all of the included include files... It's PITA. :lol:
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am

Postby mh » Tue Oct 19, 2010 1:06 pm

dreadlorde wrote:Ehh, include files shouldn't include other include files. It creates a dependency hell situation, and can make the c preprocessor take longer than necessary, as it would process the same header more than needed.

My 2 cents about that.

Well best of luck with GNU stdlib.h then!
We had the power, we had the space, we had a sense of time and place
We knew the words, we knew the score, we knew what we were fighting for
User avatar
mh
 
Posts: 2292
Joined: Sat Jan 12, 2008 1:38 am

Postby dreadlorde » Tue Oct 19, 2010 4:12 pm

mh wrote:Well best of luck with GNU stdlib.h then!
Gahhh, don't remind me..

I may use lunix (I use windows 7 too), but that doesn't mean I like the crap gnu pushes out, or lunix for that matter..
Ken Thompson wrote:One of my most productive days was throwing away 1000 lines of code.

Get off my lawn!
User avatar
dreadlorde
 
Posts: 268
Joined: Tue Nov 24, 2009 2:20 am


Return to Programming Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest