Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Apr 2012 22:37:18 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Jason Evans <jasone@canonware.com>
Cc:        Michael Pounov <misho@aitbg.com>, current@FreeBSD.org
Subject:   Re: /usr/bin/as: out of memory allocating 4194304 bytes after a total of 524288000 bytes
Message-ID:  <4F91C8FE.4070807@FreeBSD.org>
In-Reply-To: <FB2068D8-23AB-4FD6-B56D-B684631F98D7@canonware.com>
References:  <20120420125718.GD1582@albert.catwhisker.org> <20120420165558.b51c8b66.misho@aitbg.com> <4F91BDE1.4080802@FreeBSD.org> <A7FB12C8-20FE-405A-88D7-4B872E9544F5@freebsd.org> <4F91C2BB.1000808@FreeBSD.org> <99ABB17E-C564-475E-92B0-7DF92EE4CFEC@freebsd.org> <FB2068D8-23AB-4FD6-B56D-B684631F98D7@canonware.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030506060901050002030508
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 2012-04-20 22:21, Jason Evans wrote:
> On Apr 20, 2012, at 1:14 PM, Jason Evans wrote:
>> On Apr 20, 2012, at 1:10 PM, Dimitry Andric wrote:
>>> On 2012-04-20 21:54, Jason Evans wrote:
>>>> On Apr 20, 2012, at 12:49 PM, Dimitry Andric wrote:
>>>>> I think the best solution would be for jemalloc to avoid using obvious
>>>>> names like "chunksize" for its globals, because it is basically a
>>>>> library that could be linked to any sort of program out there.
>>>>>
>>>>> For example, it could prefix all its internal-use only globals with
>>>>> "jemalloc_" or some other mangling scheme.  Jason, any thoughts?
>>>>
>>>> jemalloc has optional namespace mangling support built in for just this reason.  I'll turn it on, hopefully today.
>>>
>>> Indeed, I had just found jemalloc/internal/private_namespace.h. :)  It
>>> does seem to list only functions, not variables, is that right?
>>
>> Ah right, functions only.  Well then, I don't have any bright ideas for solving this problem in the short run.
>
> I take it back.  There's spotty mangling coverage for variables.  I'll try to add full coverage.

I'm now using the attached.  It seems to work...

--------------030506060901050002030508
Content-Type: text/x-diff;
 name="jemalloc-mangle-1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="jemalloc-mangle-1.diff"

Index: contrib/jemalloc/include/jemalloc/internal/private_namespace.h
===================================================================
--- contrib/jemalloc/include/jemalloc/internal/private_namespace.h	(revision 234443)
+++ contrib/jemalloc/include/jemalloc/internal/private_namespace.h	(working copy)
@@ -1,5 +1,6 @@
 #define	arena_alloc_junk_small JEMALLOC_N(arena_alloc_junk_small)
 #define	arena_bin_index JEMALLOC_N(arena_bin_index)
+#define	arena_bin_info JEMALLOC_N(arena_bin_info)
 #define	arena_boot JEMALLOC_N(arena_boot)
 #define	arena_dalloc JEMALLOC_N(arena_dalloc)
 #define	arena_dalloc_bin JEMALLOC_N(arena_dalloc_bin)
@@ -8,6 +9,7 @@
 #define	arena_malloc JEMALLOC_N(arena_malloc)
 #define	arena_malloc_large JEMALLOC_N(arena_malloc_large)
 #define	arena_malloc_small JEMALLOC_N(arena_malloc_small)
+#define	arena_maxclass JEMALLOC_N(arena_maxclass)
 #define	arena_new JEMALLOC_N(arena_new)
 #define	arena_palloc JEMALLOC_N(arena_palloc)
 #define	arena_postfork_child JEMALLOC_N(arena_postfork_child)
@@ -24,9 +26,11 @@
 #define	arena_salloc JEMALLOC_N(arena_salloc)
 #define	arena_stats_merge JEMALLOC_N(arena_stats_merge)
 #define	arena_tcache_fill_small JEMALLOC_N(arena_tcache_fill_small)
+#define	arenas JEMALLOC_N(arenas)
 #define	arenas_bin_i_index JEMALLOC_N(arenas_bin_i_index)
 #define	arenas_cleanup JEMALLOC_N(arenas_cleanup)
 #define	arenas_extend JEMALLOC_N(arenas_extend)
+#define	arenas_lock JEMALLOC_N(arenas_lock)
 #define	arenas_lrun_i_index JEMALLOC_N(arenas_lrun_i_index)
 #define	arenas_tls JEMALLOC_N(arenas_tls)
 #define	arenas_tsd_boot JEMALLOC_N(arenas_tsd_boot)
@@ -75,6 +79,11 @@
 #define	chunk_dss_prefork JEMALLOC_N(chunk_dss_prefork)
 #define	chunk_in_dss JEMALLOC_N(chunk_in_dss)
 #define	chunk_mmap_boot JEMALLOC_N(chunk_mmap_boot)
+#define	chunk_npages JEMALLOC_N(chunk_npages)
+#define	chunks_mtx JEMALLOC_N(chunks_mtx)
+#define	chunks_rtree JEMALLOC_N(chunks_rtree)
+#define	chunksize JEMALLOC_N(chunksize)
+#define	chunksize_mask JEMALLOC_N(chunksize_mask)
 #define	ckh_bucket_search JEMALLOC_N(ckh_bucket_search)
 #define	ckh_count JEMALLOC_N(ckh_count)
 #define	ckh_delete JEMALLOC_N(ckh_delete)
@@ -129,9 +138,13 @@
 #define	extent_tree_szad_reverse_iter_start JEMALLOC_N(extent_tree_szad_reverse_iter_start)
 #define	extent_tree_szad_search JEMALLOC_N(extent_tree_szad_search)
 #define	hash JEMALLOC_N(hash)
+#define	huge_allocated JEMALLOC_N(huge_allocated)
 #define	huge_boot JEMALLOC_N(huge_boot)
 #define	huge_dalloc JEMALLOC_N(huge_dalloc)
 #define	huge_malloc JEMALLOC_N(huge_malloc)
+#define	huge_mtx JEMALLOC_N(huge_mtx)
+#define	huge_ndalloc JEMALLOC_N(huge_ndalloc)
+#define	huge_nmalloc JEMALLOC_N(huge_nmalloc)
 #define	huge_palloc JEMALLOC_N(huge_palloc)
 #define	huge_postfork_child JEMALLOC_N(huge_postfork_child)
 #define	huge_postfork_parent JEMALLOC_N(huge_postfork_parent)
@@ -153,6 +166,7 @@
 #define	jemalloc_postfork_child JEMALLOC_N(jemalloc_postfork_child)
 #define	jemalloc_postfork_parent JEMALLOC_N(jemalloc_postfork_parent)
 #define	jemalloc_prefork JEMALLOC_N(jemalloc_prefork)
+#define	malloc_conf JEMALLOC_N(malloc_conf)
 #define	malloc_cprintf JEMALLOC_N(malloc_cprintf)
 #define	malloc_mutex_init JEMALLOC_N(malloc_mutex_init)
 #define	malloc_mutex_lock JEMALLOC_N(malloc_mutex_lock)
@@ -171,12 +185,16 @@
 #define	malloc_vcprintf JEMALLOC_N(malloc_vcprintf)
 #define	malloc_vsnprintf JEMALLOC_N(malloc_vsnprintf)
 #define	malloc_write JEMALLOC_N(malloc_write)
+#define	map_bias JEMALLOC_N(map_bias)
 #define	mb_write JEMALLOC_N(mb_write)
 #define	mmap_unaligned_tsd_boot JEMALLOC_N(mmap_unaligned_tsd_boot)
 #define	mmap_unaligned_tsd_cleanup_wrapper JEMALLOC_N(mmap_unaligned_tsd_cleanup_wrapper)
 #define	mmap_unaligned_tsd_get JEMALLOC_N(mmap_unaligned_tsd_get)
 #define	mmap_unaligned_tsd_set JEMALLOC_N(mmap_unaligned_tsd_set)
 #define	mutex_boot JEMALLOC_N(mutex_boot)
+#define	narenas JEMALLOC_N(narenas)
+#define	ncpus JEMALLOC_N(ncpus)
+#define	nhbins JEMALLOC_N(nhbins)
 #define	opt_abort JEMALLOC_N(opt_abort)
 #define	opt_junk JEMALLOC_N(opt_junk)
 #define	opt_lg_chunk JEMALLOC_N(opt_lg_chunk)
@@ -190,6 +208,7 @@
 #define	opt_prof_active JEMALLOC_N(opt_prof_active)
 #define	opt_prof_gdump JEMALLOC_N(opt_prof_gdump)
 #define	opt_prof_leak JEMALLOC_N(opt_prof_leak)
+#define	opt_prof_prefix JEMALLOC_N(opt_prof_prefix)
 #define	opt_stats_print JEMALLOC_N(opt_stats_print)
 #define	opt_tcache JEMALLOC_N(opt_tcache)
 #define	opt_utrace JEMALLOC_N(opt_utrace)
@@ -206,9 +225,11 @@
 #define	prof_free JEMALLOC_N(prof_free)
 #define	prof_gdump JEMALLOC_N(prof_gdump)
 #define	prof_idump JEMALLOC_N(prof_idump)
+#define	prof_interval JEMALLOC_N(prof_interval)
 #define	prof_lookup JEMALLOC_N(prof_lookup)
 #define	prof_malloc JEMALLOC_N(prof_malloc)
 #define	prof_mdump JEMALLOC_N(prof_mdump)
+#define	prof_promote JEMALLOC_N(prof_promote)
 #define	prof_realloc JEMALLOC_N(prof_realloc)
 #define	prof_sample_accum_update JEMALLOC_N(prof_sample_accum_update)
 #define	prof_sample_threshold_update JEMALLOC_N(prof_sample_threshold_update)
@@ -238,6 +259,7 @@
 #define	stats_cactive_add JEMALLOC_N(stats_cactive_add)
 #define	stats_cactive_get JEMALLOC_N(stats_cactive_get)
 #define	stats_cactive_sub JEMALLOC_N(stats_cactive_sub)
+#define	stats_chunks JEMALLOC_N(stats_chunks)
 #define	stats_print JEMALLOC_N(stats_print)
 #define	tcache_alloc_easy JEMALLOC_N(tcache_alloc_easy)
 #define	tcache_alloc_large JEMALLOC_N(tcache_alloc_large)
@@ -247,6 +269,7 @@
 #define	tcache_arena_dissociate JEMALLOC_N(tcache_arena_dissociate)
 #define	tcache_bin_flush_large JEMALLOC_N(tcache_bin_flush_large)
 #define	tcache_bin_flush_small JEMALLOC_N(tcache_bin_flush_small)
+#define	tcache_bin_info JEMALLOC_N(tcache_bin_info)
 #define	tcache_boot0 JEMALLOC_N(tcache_boot0)
 #define	tcache_boot1 JEMALLOC_N(tcache_boot1)
 #define	tcache_create JEMALLOC_N(tcache_create)
@@ -261,6 +284,7 @@
 #define	tcache_enabled_tsd_set JEMALLOC_N(tcache_enabled_tsd_set)
 #define	tcache_event JEMALLOC_N(tcache_event)
 #define	tcache_flush JEMALLOC_N(tcache_flush)
+#define	tcache_maxclass JEMALLOC_N(tcache_maxclass)
 #define	tcache_stats_merge JEMALLOC_N(tcache_stats_merge)
 #define	tcache_thread_cleanup JEMALLOC_N(tcache_thread_cleanup)
 #define	tcache_tsd_boot JEMALLOC_N(tcache_tsd_boot)
Index: contrib/jemalloc/include/jemalloc/jemalloc_defs.h
===================================================================
--- contrib/jemalloc/include/jemalloc/jemalloc_defs.h	(revision 234443)
+++ contrib/jemalloc/include/jemalloc/jemalloc_defs.h	(working copy)
@@ -40,7 +40,7 @@
  * possibility.
  */
 #define JEMALLOC_PRIVATE_NAMESPACE ""
-#define JEMALLOC_N(string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix) string_that_no_one_should_want_to_use_as_a_jemalloc_private_namespace_prefix
+#define JEMALLOC_N(x) jemalloc_ ## x
 
 /*
  * Hyper-threaded CPUs may need a special instruction inside spin loops in

--------------030506060901050002030508--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4F91C8FE.4070807>