oshi: Process parsing breaks on Linux when names include spaces

I noticed that I can sort the running processes by memory with:

OperatingSystem.ProcessSort.MEMORY

I’m under the impression this sorting is done by shared memory (SHR) correct me if I’m wrong about this, but is it possible to sort by Resident Set Size (RSS) instead ?

Thanks!

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Also your string field would be a perfect test case for the junit test that Yoshi will be writing. 😉

Ah nice to see the issue is identified, not sure if it’s still neeeded but here’s a proc/pid/stat of one of the Firefox Web content processes anyway: 4235 (Web Content) S 4040 3749 3702 34817 3749 4194304 121952 0 3 0 2252 290 0 0 20 0 41 0 111337 2119409664 62149 18446744073709551615 94290627489792 94290627688956 140729235825792 0 0 0 0 4098 1107297528 0 0 0 17 6 0 0 79755 0 0 94290629790128 94290629791856 94290650783744 140729235831653 140729235833057 140729235833057 140729235836895 0

pid is diferent because I rebooted.

I think I might be able to clarify this:

Of course, this still doesn’t address the original issue of how the NetBeans and Firefox processes were showing unsorted

When on my first post I said I was getting firefox as the top process instead of Netbeans I was actually refering to one of those firefox child web content processes, not the parent firefox process itself. Sorry about that maybe I should’ve been clearer 😃

Sure, I’ll do the PR.

BTW, String implementations usually build a Pattern file for each call to split(). That was why we did the performance update refactoring our whitespace splits to a pattern in ParseUtil, so I’ll just add two more patterns in there, then use them to do the three chained splits.