Skip to content

Commit

Permalink
Merge develop for 1.4.3 release
Browse files Browse the repository at this point in the history
  • Loading branch information
mjansson authored Aug 6, 2021
2 parents 79d4916 + bfd26a7 commit 80daac0
Show file tree
Hide file tree
Showing 10 changed files with 182 additions and 102 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
1.4.3

Fixed an issue where certain combinations of memory page size and span map counts could cause
a deadlock in the mapping of new memory pages.

Tweaked cache levels and avoid setting spans as reserved in a heap when the heap already has
spans in the thread cache to improve cache usage.

Prefer flags to more actively evict physical pages in madvise calls when partially unmapping
span ranges on POSIX systems.


1.4.2

Fixed an issue where calling _exit might hang the main thread cleanup in rpmalloc if another
Expand Down Expand Up @@ -204,7 +216,7 @@ Provide malloc entry point replacements and automatic init/fini hooks, and a LD_

Improve documentation and additional code comments

Move benchmarks to separate repo, https://github.com/rampantpixels/rpmalloc-benchmark
Move benchmarks to separate repo, https://github.com/mjansson/rpmalloc-benchmark


1.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# rpmalloc - General Purpose Memory Allocator
This library provides a public domain cross platform lock free thread caching 16-byte aligned memory allocator implemented in C. The latest source code is always available at https://github.com/mjansson/rpmalloc

Created by Mattias Jansson ([@maniccoder](https://twitter.com/maniccoder))
Created by Mattias Jansson ([@maniccoder](https://twitter.com/maniccoder)) - Discord server for discussions at https://discord.gg/M8BwTQrt6c

Platforms currently supported:

Expand Down
39 changes: 16 additions & 23 deletions build/ninja/msvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ def initialize(self, project, archs, configs, includepaths, dependlibs, libpaths
self.linkcmd = '$toolchain$link $libpaths $configlibpaths $linkflags $linkarchflags $linkconfigflags /DEBUG /NOLOGO /SUBSYSTEM:CONSOLE /DYNAMICBASE /NXCOMPAT /MANIFEST /MANIFESTUAC:\"level=\'asInvoker\' uiAccess=\'false\'\" /TLBID:1 /PDB:$pdbpath /OUT:$out $in $libs $archlibs $oslibs'
self.dllcmd = self.linkcmd + ' /DLL'

self.cflags = ['/D', '"' + project.upper() + '_COMPILE=1"', '/D', '"_UNICODE"', '/D', '"UNICODE"', '/Zi', '/Oi', '/Oy-', '/GS-', '/Gy-', '/Qpar-', '/fp:fast', '/fp:except-', '/Zc:forScope', '/Zc:wchar_t', '/GR-', '/openmp-']
self.cwarnflags = ['/W4', '/WX']
self.cflags = ['/D', '"' + project.upper() + '_COMPILE=1"', '/D', '"_UNICODE"', '/D', '"UNICODE"', '/std:c17', '/Zi', '/Oi', '/Oy-', '/GS-', '/Gy-', '/Qpar-', '/fp:fast', '/fp:except-', '/Zc:forScope', '/Zc:wchar_t', '/GR-', '/openmp-']
self.cwarnflags = ['/W4', '/WX', '/wd4201'] #Ignore nameless union/struct which is allowed in C11
self.cmoreflags = []
self.arflags = ['/ignore:4221'] #Ignore empty object file warning]
self.linkflags = ['/DEBUG']
Expand Down Expand Up @@ -138,10 +138,11 @@ def build_toolchain(self):
tools_list.sort(key=StrictVersion)
self.toolchain = os.path.join(tools_basepath, tools_list[-1])
self.toolchain_version = major_version + ".0"
break

if self.toolchain == '':
toolchain = ''
versions = ['16.0', '15.0', '14.0', '13.0', '12.0', '11.0', '10.0']
versions = ['17.0', '16.0', '15.0']
keys = [
'HKLM\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7',
'HKCU\\SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7',
Expand All @@ -161,17 +162,18 @@ def build_toolchain(self):
except:
continue
if not toolchain == '':
if version == '15.0' or version == '16.0':
tools_basepath = os.path.join(toolchain, 'VC', 'Tools', 'MSVC')
tools_list = [item for item in os.listdir(tools_basepath) if os.path.isdir(os.path.join(tools_basepath, item))]
from distutils.version import StrictVersion
tools_list.sort(key=StrictVersion)
toolchain = os.path.join(tools_basepath, tools_list[-1])
tools_basepath = os.path.join(toolchain, 'VC', 'Tools', 'MSVC')
tools_list = [item for item in os.listdir(tools_basepath) if os.path.isdir(os.path.join(tools_basepath, item))]
from distutils.version import StrictVersion
tools_list.sort(key=StrictVersion)
toolchain = os.path.join(tools_basepath, tools_list[-1])
self.toolchain = toolchain
self.toolchain_version = version
break
if not self.toolchain == '':
break
if self.toolchain == '':
raise Exception("Unable to locate any installed Visual Studio toolchain")
self.includepaths += [os.path.join(self.toolchain, 'include')]
if self.sdkpath == '':
versions = ['v10.0', 'v8.1']
Expand Down Expand Up @@ -237,13 +239,10 @@ def make_libpaths(self, libpaths):
return []

def make_arch_toolchain_path(self, arch):
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
if arch == 'x86-64':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x64\\')
elif arch == 'x86':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x86\\')
if arch == 'x86-64':
return os.path.join(self.toolchain, 'bin', 'amd64\\')
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x64\\')
elif arch == 'x86':
return os.path.join(self.toolchain, 'bin', 'HostX64', 'x86\\')
return os.path.join(self.toolchain, 'bin\\')

def make_carchflags(self, arch, targettype):
Expand Down Expand Up @@ -321,20 +320,14 @@ def make_configlibpaths(self, config, arch, extralibpaths):
libpaths += [os.path.join(libpath, self.libpath, config, arch) for libpath in extralibpaths]
if self.sdkpath != '':
if arch == 'x86':
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
libpaths += [os.path.join(self.toolchain, 'lib', 'x86')]
else:
libpaths += [os.path.join(self.toolchain, 'lib')]
libpaths += [os.path.join(self.toolchain, 'lib', 'x86')]
if self.sdkversion == 'v8.1':
libpaths += [os.path.join( self.sdkpath, 'lib', 'winv6.3', 'um', 'x86')]
if self.sdkversion == 'v10.0':
libpaths += [os.path.join(self.sdkpath, 'lib', self.sdkversionpath, 'um', 'x86')]
libpaths += [os.path.join(self.sdkpath, 'lib', self.sdkversionpath, 'ucrt', 'x86')]
else:
if self.toolchain_version == '15.0' or self.toolchain_version == '16.0':
libpaths += [os.path.join( self.toolchain, 'lib', 'x64')]
else:
libpaths += [os.path.join( self.toolchain, 'lib', 'amd64')]
libpaths += [os.path.join( self.toolchain, 'lib', 'x64')]
if self.sdkversion == 'v8.1':
libpaths += [os.path.join( self.sdkpath, 'lib', 'winv6.3', 'um', 'x64')]
if self.sdkversion == 'v10.0':
Expand Down
2 changes: 1 addition & 1 deletion build/ninja/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def generate_version_string(libname):
if sys.platform.startswith('win'):
gitcmd = 'git.exe'
try:
git_version = subprocess.check_output( [ gitcmd, 'describe', '--long' ], stderr = subprocess.STDOUT ).strip()
git_version = subprocess.check_output( [ gitcmd, 'describe', '--tags', '--long' ], stderr = subprocess.STDOUT ).strip()
tokens = git_version.decode().split( '-' )
version_numbers = tokens[0].split( '.' )
except Exception:
Expand Down
13 changes: 9 additions & 4 deletions build/ninja/vslocate.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,15 @@ class ISetupConfiguration(ctypes.Structure):
ctypes.POINTER(ctypes.POINTER(ISetupConfiguration)),
ctypes.c_void_p)

installations = []
dll = None

dll_path = os.path.expandvars("$ProgramData\\Microsoft\\VisualStudio\\Setup\\x64\\Microsoft.VisualStudio.Setup.Configuration.Native.dll")
dll = ctypes.WinDLL(dll_path)
try:
dll = ctypes.WinDLL(dll_path)
except OSError as e:
#print("Failed to load Visual Studio setup configuration DLL: " + str(e))
return installations

params_get_setup_configuration = (1, "configuration", 0), (1, "reserved", 0),

Expand All @@ -98,8 +105,6 @@ class ISetupConfiguration(ctypes.Structure):
configuration = ctypes.POINTER(ISetupConfiguration)()
reserved = ctypes.c_void_p(0)

installations = []

result = get_setup_configuration(ctypes.byref(configuration), reserved)
if result != 0:
#print("Failed to get setup configuration: " + str(result))
Expand All @@ -110,7 +115,7 @@ class ISetupConfiguration(ctypes.Structure):
enum_setup_instances = ctypes.POINTER(IEnumSetupInstances)()
result = enum_instances(configuration, ctypes.byref(enum_setup_instances))
if result != 0:
#print("Failed to enum setup instances: " + str(result))
#print("Failed to enum setup instances: " + str(result))
return installations


Expand Down
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

import generator

generator = generator.Generator(project = 'rpmalloc', variables = [('bundleidentifier', 'com.rampantpixels.rpmalloc.$(binname)')])
generator = generator.Generator(project = 'rpmalloc', variables = [('bundleidentifier', 'com.maniccoder.rpmalloc.$(binname)')])

rpmalloc_lib = generator.lib(module = 'rpmalloc', libname = 'rpmalloc', sources = ['rpmalloc.c'])
rpmalloc_test_lib = generator.lib(module = 'rpmalloc', libname = 'rpmalloc-test', sources = ['rpmalloc.c'], variables = {'defines': ['ENABLE_ASSERTS=1', 'ENABLE_STATISTICS=1', 'RPMALLOC_FIRST_CLASS_HEAPS=1', 'RPMALLOC_CONFIGURABLE=1']})
Expand Down
Loading

0 comments on commit 80daac0

Please sign in to comment.