Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check_alias_usage results in a malloc error failing to load counting data #106

Open
3 tasks
andrewcrook opened this issue Aug 8, 2020 · 4 comments
Open
3 tasks

Comments

@andrewcrook
Copy link

andrewcrook commented Aug 8, 2020

Issue Details

possible bug
check_alias_usage results in a malloc error.
Aliases seem to be listed, however, the counting data is always 0.

Operating System (uname -a)

macOS Catalina 10.15.6 (19G73)

Darwin Andrews-MBP.local 19.6.0 Darwin Kernel Version 19.6.0: Sun Jul 5 00:43:10 PDT 2020; root:xnu-6153.141.1~9/RELEASE_X86_64 x86_64

zsh version (zsh --version)

zsh 5.7.1 (x86_64-apple-darwin19.0)

you-should-use version (echo "$YSU_VERSION")

1.7.3

How is zsh-you-should-use installed?

  • zplug
  • oh-my-zsh
  • Antigen
  • [ X] Other (please specify)

Antibody

Steps to reproduce the issue

❯ ~
❯ check_alias_usage

tail(23339,0x110ca1dc0) malloc: can't allocate region
:*** mach_vm_map(size=144000000000000000, flags: 100) failed (error code=3)
tail(23339,0x110ca1dc0) malloc: *** set a breakpoint in malloc_error_break to debug
tail: malloc: Cannot allocate memory
0: ~='cd ~'
0: z='_z 2>&1'
0: which-command='whence'
0: sc='source /Users/andrew/.zshrc'
0: run-help='man

Expected

  • no errors
  • increment the count on the alias ~
@andrewcrook andrewcrook changed the title check_alias_usage results in a malloc error check_alias_usage results in a malloc error failing to load counting data Aug 8, 2020
@MichaelAquilina
Copy link
Owner

Thanks for reporting this issue! I actually noticed there's another regression in check_alias_usage last time so I would not be surprised if this is related.

Would you mind checking how much available free memory you had when running this?

@andrewcrook
Copy link
Author

@MichaelAquilina sure top from the same shell and activity monitor. Plenty available.

> top

Processes: 411 total, 2 running, 409 sleeping, 1890 threads           13:58:49
Load Avg: 0.90, 1.19, 1.39  CPU usage: 3.49% user, 3.1% sys, 93.48% idle
SharedLibs: 307M resident, 77M data, 25M linkedit.
MemRegions: 74035 total, 5188M resident, 212M private, 2348M shared.
PhysMem: 14G used (2829M wired), 2345M unused.
VM: 2860G vsize, 1993M framework vsize, 94632(0) swapins, 168460(0) swapouts.
Networks: packets: 1925400/1744M in, 6108827/5941M out.
Disks: 999645/13G read, 345972/5090M written.

Activity Monitor

image

@MTCoster
Copy link

MTCoster commented Jul 6, 2022

I've just encountered this (although interestingly on Monterey tail seems to be using calloc instead of malloc) - I suspect it's to do with this:

# Optional parameter that limits how far back history is checked
# I've chosen a large default value instead of bypassing tail because it's simpler
# TODO: this should probably be cleaned up
local limit="${1:-9000000000000000}"

@andrewcrook
Copy link
Author

andrewcrook commented Jul 7, 2022

tail seems to be using calloc instead of malloc

not sure iirc the different between calloc and malloc is that calloc zeros out the memory allocation and malloc doesn’t. I suppose calloc is the slower of the two. I have since switched to bash as my main shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants