Better HN
topnewbestaskshowjobs
Log inSign up

ric129

18 karma · joined May 22, 2016 (10y ago) · 17 submissions

Submissions

comment 10mo ago · link · parent

I do like that the article touches exactly this, and even though I'm a stranger to the entire concept, it makes sense:

>Hardly anyone hitchhikes any more, which is a shame because it encourages the habit of generosity from drivers, and it nurtures the grace of gratitude and patience of being kinded from hikers

I can see how it becomes a healthy feedback loop

comment 1y ago · link · parent

that’s the submitters‘ user name, not the submission date

comment 2y ago · link · parent

There's an inherent trade-off in everything

Besides, in this case.. it does not help that you'd also have to exchange hardware

comment 2y ago · link · parent

I recall plenty of implementations turning into the same as a memory_order_acquire, which seems fine these days

comment 4y ago · link · parent

What if your young 'uns just do not... participate?

I am in a position where I am doing TL-level decisions, and try quite hard to demo, discuss, share the details and rationale. I write design proposals, documentation, do demo sessions, etc

But the information is just not flowing, and I notice how little the juniors participate in anything. And I don't exactly know what to put my finger on. It's probably some soft-skill I'm lacking, and that I do not know how to improve

But a part of me still feels that that perhaps the young 'uns are just... too fresh. Or that the approach is just too optimistic

comment 5y ago · link · parent

Yes, all allocators (except perhaps OpenBSDs from what I see in this thread) do this. It is also why `calloc` exists - because zero-initializing every single allocation is really, really expensive.

comment 6y ago · link · parent

I'm fairly confident that SQLite deals well with filesystem crashes nowadays, see https://www.sqlite.org/testing.html and https://www.sqlite.org/atomiccommit.html

comment 7y ago · link · parent

>I'd never heard of the Robson bounds but they seem quite crucial to know about

I'd argue it's not really important in modern systems due to the use of virtual memory. With virtual memory, you can massive reduce fragmentation since you are no longer managing a single continuous region of memory.

Fragmentation still exists, but it only applies to "small" allocations (think smaller than a page) and in most scenarios it is a result of modern memory allocators preferring performance over reduced memory usage. Memory is cheap nowadays, and performance is king.

>Does anyone have some kind of list of the most important results in the area of memory management?

There is a survey [1] on the subject of memory allocation that mentions Robson's bounds and other results

[1] https://link.springer.com/chapter/10.1007/3-540-60368-9_19

comment 7y ago · link · parent

By "mobile" I'm guessing you mean laptops, and not phones.

Energy consumption of AMD's x86-64 CPUs are only impressive when comparing with Intel, they're not competitive with current ARM CPUs.

comment 8y ago · link · parent

>It's applicable to C because most realistic implementations of malloc(3) store the size of the malloc'd area to the nearest word[2]

This is not so true anymore, and I'd be very careful with that sort of tricks. While the default memory allocator on most distributions (ptmalloc2) still probably works like that, there are other memory allocators in use like jemalloc/tcmalloc, which store metadata for a group of blocks (e.g all equal-sized blocks in a page) rather than for every single block.

Like Asooka wrote, you can malloc_usable_size(), if available. But have in mind that malloc_usable_size() returns the size of the block that malloc has given you, which can be _larger_ than the size you requested, as many memory allocators round block sizes up.

I actually wrote a memory allocator that works that way: https://github.com/ricleite/lrmalloc

comment 8y ago · link · parent

There's malloc_usable_size[1], assuming you mean asking the memory allocator what the array size is. But chances are that wouldn't work correctly, because what the amount of memory a malloc calls gives you and the amount you requested are often not the same. Modern memory allocators round up the request size to the nearest "size class".

[1]: http://man7.org/linux/man-pages/man3/malloc_usable_size.3.ht...

comment 8y ago · link · parent

What if you lose your Yubikey?

comment 9y ago · link · parent

Only virtual functions behave as you described, and even them don't exactly cause a function pointer to be stored in an object.

comment 9y ago · link · parent

Browsers have already taught us how useless this is, users will always click through.

comment 10y ago · link · parent

>The funny thing is Microsoft’s linked lists are faster than C++ standard vectors.

If I had to guess, it's because the std::vector is more conservative in memory use and it causes more malloc/array copy calls.

comment 10y ago · link · parent

That sounds very economically taxing.

comment 10y ago · link · parent

It's C++, I recall using C++11 constructs on a recent Arduino project.