Help Bites
-
@Rhywden I didn't know Nokia still existed. I was actually considering just getting a OnePlus 6 and using the savings to tell Verizon to go fuck themselves.
-
So, getting new Auto insurance (yay )
Travelers wants me to call and answer questions (Should take only a few minutes, we swear!).
Liberty Mutual says my annual is $1,127
Geico says my semiannual is $491 (so $982 annual, probably).
Any misgivings/grief/opinion for or against the other?
We'll close the auction after, say, 20 posts.
Edit: and here come the "no wait, come back!" emails...
-
@pie_flavor said in Help Bites:
I can't believe I'm actually arguing with someone who thinks scribbling is faster than typing.
I can't believe you actually do this shit on a computer. Is this really what slows you down? It would have never occurred to me to do something like this.
-
@Gąska said in Help Bites:
Paint: 44 seconds (with mouse)
Specialized equation editor: 16 seconds
LaTeX: it's second day and they're still figuring out the best way to do it.That's what you get when you care it doesn't look like shit. If you prefer to read MS Paint equations, more power to you.
-
@topspin said in Help Bites:
That's what you get when you care it doesn't look like shit.
Stuff you're writing on scratch paper just needs to be barely legible. I'd always do stuff there and then copy it more carefully to the paper that I'd actually turn in. That also meant that I didn't have to erase mistakes or blind alleys that I tried.
-
@boomzilla Well of course, different use cases. I don't typeset shit that doesn't get published/handed in/whatever, as you said there's scratch paper for that.
-
@Tsaukpaetra I'm with Geico. They're ok. All of their services other than car insurance are partnerships with terrible companies, so if you want like condo insurance or something don't even bother with them. (They claim "they" insure everything, but the reality is they just refer you to other companies.)
-
@boomzilla said in Help Bites:
@pie_flavor said in Help Bites:
I can't believe I'm actually arguing with someone who thinks scribbling is faster than typing.
I can't believe you actually do this shit on a computer. Is this really what slows you down? It would have never occurred to me to do something like this.
It's faster to do it like that and my computer's already on and next to me. Plus my assignments are online.
-
@pie_flavor said in Help Bites:
Plus my assignments are online.
Excuse me. There are some clouds that need yelling at.
-
@boomzilla said in Help Bites:
There are some clouds that need yelling at.
-
@TimeBandit seriously, we've had too much rain this year.
-
@boomzilla said in Help Bites:
@TimeBandit seriously, we've had too much rain this year.
Thiefs! Everything here’s dried out.
-
@Tsaukpaetra said in Help Bites:
We'll close the auction after, say, 20 posts.
I lied, doing it now!
Looks like the winner is Geico.
Oh wait...
-
-
@dcon said in Help Bites:
@Tsaukpaetra said in Help Bites:
That's the kind of security answer I'd use...
I had to use four because three wasn't enough letters apparently.
-
@pie_flavor All right, so I'm saying fuck it and taking a OnePlus. Question number two: Since I'd rather get the newer one than the older one, and the newer one doesn't have a headphone jack, can anyone recommend a good medium-end pair of USB-C earbuds? My Xiaomi Hybrid Pros have been phenomenal but I don't want to have to deal with dongle hell.
-
@pie_flavor my Bluboo S3 doesn't have audio jack, but it came with jack<->USB-C converter. Maybe check if your phone comes with one too?
-
@pie_flavor said in Help Bites:
but I don't want to have to deal with dongle hell.
There's plenty of compatibility issues everywhere you look. And that's one more thing to eventually lose.
-
@pie_flavor If you like your earbuds and you're only going to be using them with the phone, why not just keep the dongle attached to them?
-
@hungrier Who says I'm only going to be using them with my phone?
-
@pie_flavor said in Help Bites:
There's plenty of compatibility issues everywhere you look.
That's why I asked if your one comes with one. If it doesn't, there's a fair chance no converter will work with your phone at all (including dedicated USB-C headphones). But if it does, it's 100% guaranteed to work.
And that's one more thing to eventually lose.
If you don't use those headphones for anything else, you can just keep the plug inside converter all the time. And if you buy dedicated USB-C ones, you won't use them for anything else either. So you could spend the same money and buy quality headphones for whatever else you use headphones for. Or save money by buying headphones of comparable quality to the USB-C ones.
-
@Gąska said in Help Bites:
And if you buy dedicated USB-C ones, you won't use them for anything else either.
Yes I will. My computer has a USB-C port right next to the headphone jack, never used.
-
@pie_flavor said in Help Bites:
@hungrier Who says I'm only going to be using them with my phone?
You definitely will if you buy new ones just for the phone. And they'll be more expensive than a dongle (especially if the phone comes with one!)
-
@pie_flavor said in Help Bites:
@Gąska said in Help Bites:
And if you buy dedicated USB-C ones, you won't use them for anything else either.
Yes I will. My computer has a USB-C port right next to the headphone jack, never used.
Even less reason to disconnect the converter.
-
@Gąska hmm? Wouldn't the sound be better?
-
@pie_flavor said in Help Bites:
Wouldn't the sound be better?
Why, because it will be all digital?
Hint: your ears are not
-
@TimeBandit I dunno, it just seems like it'd make sense since a wired standard has a maximum throughput and 3.5mm's would be less than USB-C's. Maybe I don't understand analog audio.
-
@pie_flavor It wouldn't depend so much on the throughput of the analog signal (plenty), but the quality of the DAC in the earbuds or adapter. Unless the USB-C wire can carry an analog signal that's pre-converted by the phone, but I don't think that's how it works.
e: According to this article, the answer is "maybe"
-
@pie_flavor said in Help Bites:
@TimeBandit I dunno, it just seems like it'd make sense since a wired standard has a maximum throughput and 3.5mm's would be less than USB-C's.
The sound of the headphones you currently have will be no worse than the sound of the headphones you currently have, if that's what you're asking. Even with additional converter.
-
Any US cities that would belong to the upper left quarter of this graph that aren't on West Coast? I want to know where I want to live in the future.
-
@Gąska I don't think so. Inland areas, far from the moderating influence of the oceans, tend to have more extreme temperatures than coastal areas. It seems logical that there would be somewhere along the east coast that would also have a moderate climate, but for some reason that's not the case. You can't escape hot, humid summers without going so far north that you get frigid winters.
-
@HardwareGeek So I guess the answer is to settle for the dead center of the chart and move to Lubbock
-
In PL/SQL, how do I find out whether a given object is inside a given varray of references? Alternatively, what other container instead of varray can I use as an attribute of a type to store references of another object type, that lets me add objects and check if a given object is there already? Both types have NUMBER as primary key (well, it's PK of their tables, but it's an unique ID still).
Yes, it has to be objects and references. College work.
-
@Gąska said in Help Bites:
PL/SQL
Sorry, I don't know that dialect.
I would assume some sort of subquery, or internal outer join, but otherwise I cannot suppose.
-
@hungrier said in Help Bites:
@HardwareGeek So I guess the answer is to settle for the dead center of the chart and move to Lubbock
Well then you can find happiness. When you move out.
-
How do you use
ulimit
correctly to limit memory usage?The
-v
option limits the the size of virtual memory
The-m
option limits the maximum resident set sizeI have an application that, upon start, reports around 20MB of
RES
(resident memory) in top but around 500MB ofVIRT
(virtual memory). The overall memory usage increases only by a few MB, so RES seems to correctly reflect that. Also, the Windows version only uses about that amount in Task Manager, not 500MB.Say I want to limit the applications memory usage to around 300MB. I don't care about the address space usage at all. Sounds like
-m
is the way to go.
Usingulimit -v 300000
the application doesn't even start up. So much as expected.
Usingulimit -m 300000
, however, doesn't seem to do anything at all. If I load a huge file then top reports a usage of 1.5GB VIRT and 1GB RES, without any problems. I expected it to fail once RES reaches the limit of 300MB.What does it do? Page stuff out once it's over the limit?
That isn't really what I want.
-
@topspin said in Help Bites:
The -m option limits the maximum resident set size
$ strace -e setrlimit sh -c 'ulimit -m 1' setrlimit(RLIMIT_RSS, {rlim_cur=1024, rlim_max=1024}) = 0 +++ exited with 0 +++
Unfortunately,
man setrlimit
says:RLIMIT_RSS
This is a limit (in bytes) on the process's resident set (the number of virtual pages resident in RAM). This limit has effect only in Linux 2.4.x, x < 30, and
there affects only calls to madvise(2) specifying MADV_WILLNEED.You might have better luck with cgroups, which are, admittedly, a lot to digest in a single reading, but seem to have the required functionality (memory controller with ability to set
memory.high
).
-
@aitap So, effectively, the
-m
switch doesn’t work?
Thestrace
thing looks like a nice trick, but it seems you have to know what you’re searching for before you can search it, which is a bit catch-22.I found references to
cgroups
while googling but it seemed like a lot to set up / read. Can I do an ad-hoc one without user permissions or do I need root?Thanks!
-
@topspin said in Help Bites:
So, effectively, the
-m
switch doesn’t work?Yeah.
The
strace
thing looks like a nice trick, but it seems you have to know what you’re searching for before you can search it, which is a bit catch-22.Fair enough. Though in this case the full output of strace is about two screenfuls and I could
grep
it forlimit
instead.I found references to
cgroups
while googling but it seemed like a lot to set up / read. Can I do an ad-hoc one without user permissions or do I need root?The HOWTOs I'd read tell me I have to have root to create a cgroup, but, once created, the ownership could be given to a particular user:
/sys/fs/cgroup # mkdir memory /sys/fs/cgroup # mount -t cgroup -o memory memory memory /sys/fs/cgroup # mkdir memory/aitap /sys/fs/cgroup # chown -R aitap:aitap memory/aitap/ /sys/fs/cgroup $ cd memory/aitap/ /sys/fs/cgroup/memory/aitap $ echo 300000000 > memory.limit_in_bytes /sys/fs/cgroup/memory/aitap $ echo $pid > tasks
This causes the kernel to start swapping the process out when it tries to go over RSS limit.
/sys/fs/cgroup/memory/aitap $ echo 0 > memory.swappiness
This invokes OOM-killer the moment the process goes over the limit.
sys/fs/cgroup/memory/aitap $ echo 1 > memory.oom_control
This causes the offending process to be blocked undefinitely when the cgroup runs out of memory.
Hmm. Does
malloc
ever returnNULL
on modern Linux?
-
@aitap said in Help Bites:
Hmm. Does
malloc
ever returnNULL
on modern Linux?Nope, unfortunately. Only when the OOM killer / overcommiting is disabled. I’ve complained about this before, since my program handles a
bad_alloc
gracefully on Windows. (As far as that goes. A message box is better than disappearing)
-
@topspin my first question is: is it actually locking that memory, or is it just asking for that much "just in case"?
I seem to recall that "allocated" virtual memory may not actually be using any real memory until it's actually used.
What is it doing that causes it to request that much? If you can dive into the source for that it might be easier to fix there than hacking around with debugging tools...
Edit: here, have a SO question:
-
@Tsaukpaetra No, it isn't, that's the point.
Unlike-m
the-v
switch works, but I would've preferred not using that because I don't want to restrict address space usage but actual memory usage. It is in fact pretty common to use a whole bunch more address space than actual memory.
-
@topspin said in Help Bites:
. It is in fact pretty common to use a whole bunch more address space than actual memory.
But I think I'm missing the point where that's a bad thing.
Say I memory mapped a 28 gb file. That would show up on virtual memory. But it isn't actually using 28gb of memory, see?
It seems to me that you're troubleshooting an issue that's not an issue.
-
@Tsaukpaetra said in Help Bites:
@topspin said in Help Bites:
. It is in fact pretty common to use a whole bunch more address space than actual memory.
But I think I'm missing the point where that's a bad thing.
It isn't!
That's why I tried to use the -m switch to limit actual memory use.Say I memory mapped a 28 gb file. That would show up on virtual memory. But it isn't actually using 28gb of memory, see?
It seems to me that you're troubleshooting an issue that's not an issue.
You need some coffee. I've not been doing that.
-
@Tsaukpaetra Threads add up quickly as well, if the total is only 500mb. I think default stack size is 8mb, with a similar number again as stack protector (will never be mapped but does count as address space), while actual usage can easily stay in the kilobyte range.
I also wouldn't be surprised if malloc aggressively pre-allocates areas of memory to allocate small chunks, since that probably keeps its administration fast if the process ends up using a lot of them.
-
@aitap said in Help Bites:
Hmm. Does
malloc
ever returnNULL
on modern Linux?From some tests I did when I tried to do similar stuff to what's being asked here (spoiler alert: I never quite managed to do it, memory management is far too weird for me...), it only returns NULL when you ask it a hugely insane amount of memory (like a few TB at once or so). Which, unless there is something very wrong going on in your program, means that in practice, no, it never does.
-
@remi I had that happen at some point. I think I was asking for something to the tune of
(size_t)(signed int)(3*1024*1024*1024)
bytes.
-
@topspin said in Help Bites:
Also, the Windows version only uses about that amount in Task Manager, not 500MB.
Don't use Task Manager to gauge process' memory usage, because it's nowhere near accurate. Practically the only thing that can show you how much memory a process uses on Windows is VMMap.
-
@PleegWat said in Help Bites:
@remi I had that happen at some point. I think I was asking for something to the tune of
(size_t)(signed int)(3*1024*1024*1024)
bytes.I think that goes nicely under the definition of "there is something very wrong going on in your program".
-
@topspin said in Help Bites:
You need some coffee. I've not been doing that.
Have you ever heard of an example? Bruce Almighty, when did I claim you were?