zsh-workers
 help / color / mirror / code / Atom feed
* out of memory error after "edit-command-line"
@ 2022-08-02  3:47 Jim
  0 siblings, 0 replies; only message in thread
From: Jim @ 2022-08-02  3:47 UTC (permalink / raw)
  To: devs


[-- Attachment #1.1: Type: text/plain, Size: 1165 bytes --]

Hi everyone,

ZSH_VERSION: 5.8 (Distribution, Devuan, still hasn't update)
$ZSH_PATCHLEVEL:  debian/5.8-6+deb11u1
default editor nvim version v0.4.4
Also tested with VIM - Vi IMproved 8.2
terminal emulators/multiplexer:  tmux, xfce4-terminal, st, and
kitty(checked on all)

.zshrc
  autoload -Uz edit-command-line
  zle -N edit-command-line
  bindkey -M vicmd v edit-command-line

Created an anonymous function(see attachment ps_via_zsh) by entering
edit-command-line
which seems to work ok after exiting editor and hitting enter. But
then(after adding code) started
getting out of memory errors(see attachment out_of_memory).  When I recall
the anonymous
function from history and execute, no error. Started commenting out lines
and found that the issues
stops with the line:

CL=${(0A)$(</proc/$P/cmdline)} ; PP=${AA[PPid]} ; Cmd=${AA[Name]}

commented out. Splitting line found issue to be with
CL=${(0A)$(</proc/$P/cmdline)}
Again, recalling from history -- no edit-command-line -- no error.
BTW: /proc/<pid>/cmdline uses NULL as the separator.

QUESTION:  Bug, or am I doing something stupid? Or something with nvim and
vim?

Thanks for listening,

Jim Murphy

[-- Attachment #1.2: Type: text/html, Size: 1549 bytes --]

[-- Attachment #2: ps_via_zsh --]
[-- Type: application/octet-stream, Size: 850 bytes --]

()
{ # Z-Shell version of 'ps -o pid=,ppid=,tty=,comm=,args= $$'
  emulate -L zsh
  # FunCTioN:  ps_via_zsh
  [[ -v modules[zsh/datetime] ]] || zmodload zsh/datetime
  local ST ET
  ST=$EPOCHREALTIME
  ps -o pid=,ppid=,tty=,comm=,args= $$
  ET=$EPOCHREALTIME
  print $(( ST - ET ))
  ST=$EPOCHREALTIME
  [[ -v modules[zsh/stat] ]] || zmodload zsh/stat
  local     CL Cmd E P PP T
  local -a  A B
  local -A  AA
  P=$$
  T="$(zstat +link /proc/$P/fd/0)"
  A=(${(M)${${(f)"$(</proc/$P/status)"}:s/:/,}:#(Name|PPid),*})
  for E ($A) {
    B=(${(s.,.)E})
    B[2]=${(MS)B[2]##[[:graph:]]*[[:graph:]]} # remove leading/trailing white space
    AA[$B[1]]="$B[2]"
  }
  CL=${(0A)$(</proc/$P/cmdline)} ; PP=${AA[PPid]} ; Cmd=${AA[Name]}
  print -- ${(l.5.. .)P} ${(l.5.. .)PP} ${(r.12.. .)T} ${(r.15.. .)Cmd} $CL
  ET=$EPOCHREALTIME
  print $(( ST - ET ))
}

[-- Attachment #3: out_of_memory --]
[-- Type: application/octet-stream, Size: 1347 bytes --]

[ 2065.764363] Out of memory: Killed process 12153 (zsh) total-vm:6812316kB, anon-rss:6802224kB, file-rss:0kB, shmem-rss:0kB, UID:17227 pgtables:13360kB oom_score_adj:0
[ 1681.950581] Out of memory: Killed process 12116 (zsh) total-vm:6818304kB, anon-rss:6802244kB, file-rss:0kB, shmem-rss:0kB, UID:17227 pgtables:13384kB oom_score_adj:0
[23829.634980] Out of memory: Killed process 12375 (zsh) total-vm:5084260kB, anon-rss:5075368kB, file-rss:0kB, shmem-rss:0kB, UID:17227 pgtables:9992kB oom_score_adj:0
[35153.665324] Out of memory: Killed process 12338 (zsh) total-vm:4940764kB, anon-rss:4931592kB, file-rss:0kB, shmem-rss:0kB, UID:17227 pgtables:9712kB oom_score_adj:0
[35777.880940] Out of memory: Killed process 15754 (zsh) total-vm:5090388kB, anon-rss:5081832kB, file-rss:0kB, shmem-rss:0kB, UID:17227 pgtables:10000kB oom_score_adj:0
[36283.820854] Out of memory: Killed process 15709 (zsh) total-vm:5067208kB, anon-rss:5058760kB, file-rss:4kB, shmem-rss:0kB, UID:17227 pgtables:9952kB oom_score_adj:0
[36533.967014] Out of memory: Killed process 30580 (zsh) total-vm:5024676kB, anon-rss:5016104kB, file-rss:4kB, shmem-rss:0kB, UID:17227 pgtables:9868kB oom_score_adj:0
[37206.318183] Out of memory: Killed process 31268 (zsh) total-vm:5024168kB, anon-rss:5012684kB, file-rss:0kB, shmem-rss:0kB, UID:17227 pgtables:9872kB oom_score_adj:0

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-08-02  3:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02  3:47 out of memory error after "edit-command-line" Jim

Code repositories for project(s) associated with this inbox:

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).