Add new WITH_SYSTEM_MALLOC knob, which results in system malloc being used

for memory allocation instead of SER's own one. Stress tests failed to
show any considerable difference in the performance, while system version
provides much better scalability and in future should also provide some
benefits on SMP systems.
This commit is contained in:
Maxim Sobolev 2006-11-02 21:59:45 +00:00
parent c82e84ead8
commit 33cbf3a9c2
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=176235
3 changed files with 44 additions and 1 deletions

View file

@ -7,7 +7,7 @@
PORTNAME= ser PORTNAME= ser
PORTVERSION= 0.9.6 PORTVERSION= 0.9.6
PORTREVISION= 3 PORTREVISION= 4
CATEGORIES= net CATEGORIES= net
MASTER_SITES= http://download.berlios.de/ser/ \ MASTER_SITES= http://download.berlios.de/ser/ \
http://download2.berlios.de/ser/ http://download2.berlios.de/ser/
@ -30,6 +30,10 @@ MANCOMPRESSED= no
.include <bsd.port.pre.mk> .include <bsd.port.pre.mk>
.if !defined(WITH_SYSTEM_MALLOC)
MAKE_ENV+= "extra_defs=-DF_MALLOC -DPKG_MALLOC"
.endif
.if !defined(WITHOUT_MYSQL) .if !defined(WITHOUT_MYSQL)
USE_MYSQL= yes USE_MYSQL= yes
PLIST_SUB+= MYSQL="" PLIST_SUB+= MYSQL=""

View file

@ -19,6 +19,23 @@ $FreeBSD$
#set some vars from the environment (and not make builtins) #set some vars from the environment (and not make builtins)
CC := $(shell echo "$${CC}") CC := $(shell echo "$${CC}")
@@ -321,14 +322,14 @@
-DNAME='"$(MAIN_NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
-DOS='"$(OS)"' -DCOMPILER='"$(CC_VER)"' -D__CPU_$(ARCH) -D__OS_$(OS) \
-DCFG_DIR='"$(cfg-target)"'\
- -DPKG_MALLOC \
-DSHM_MEM -DSHM_MMAP \
-DDNS_IP_HACK \
-DUSE_IPV6 \
-DUSE_MCAST \
-DUSE_TCP \
-DDISABLE_NAGLE \
- -DF_MALLOC \
+ #-DPKG_MALLOC \
+ #-DF_MALLOC \
#-DDBG_QM_MALLOC \
#-DDBG_F_MALLOC \
#-DNO_DEBUG \
@@ -464,8 +465,8 @@ @@ -464,8 +465,8 @@
found_lock_method=yes found_lock_method=yes
endif endif

View file

@ -0,0 +1,22 @@
$FreeBSD$
--- mem/mem.h.orig
+++ mem/mem.h
@@ -122,9 +122,13 @@
#else
# include <stdlib.h>
# define pkg_malloc(s) \
- ( { void *v; v=malloc((s)); \
- DBG("malloc %p size %d end %p\n", v, s, (char*)v+(s));\
- v; } )
+ ( { void *____v123; ____v123=malloc((s)); \
+ DBG("malloc %p size %lu end %p\n", ____v123, (unsigned long)(s), (char*)____v123+(s));\
+ ____v123; } )
+# define pkg_realloc(p, s) \
+ ( { void *____v123; ____v123=realloc(p, s); \
+ DBG("realloc %p size %lu end %p\n", ____v123, (unsigned long)(s), (char*)____v123+(s));\
+ ____v123; } )
# define pkg_free(p) do{ DBG("free %p\n", (p)); free((p)); }while(0);
# define pkg_status()
#endif