Andrew Torr
Andrew Torr

Reputation: 1127

Massive hprof files being created somehow, preventing me from pushing

I am currently unable to push changes I've made to a project to GitHub because it keeps finding these massive (~300MB) files called "java_pid(random numbers).hprof". I have no idea where they're coming from. Google searches aren't coming up with anything helpful - everyone else is asking about how to use them, and with regard to Eclipse, and I'm using Android Studio, and I don't care what's in them, I just want them gone.

Please help!

Upvotes: 39

Views: 36586

Answers (7)

Zekai Oguz Ozalp
Zekai Oguz Ozalp

Reputation: 11

It's just heap dump. I was lucky enough to catch early. Removed large files and do git commit --amend to get rid of it.

Upvotes: 1

deathemperor
deathemperor

Reputation: 1436

I stumbled on this problem recently and found that BFG helped.

BFG can be installed using Homebrew in macOS. Then I run:

bfg --strip-blobs-bigger-than 100M /git_folder/

…to remove any file bigger than 100MB on git history then run:

git reflog expire --expire=now --all && git gc --prune=now --aggressive

Finally I push and everything works.

Upvotes: 15

Elsabeth Kidane
Elsabeth Kidane

Reputation: 5

I had the same problem,I wasnt able to push my changes to git,when i checked git status it kept on giving me untracked files ,when i try to do git stash it didnt work, they kept on appearing again, so I went to visual studio,and found the untracked *.hprof files and deleted them from there,now I am able to push my changes to git.

Upvotes: 0

Nick Foden
Nick Foden

Reputation: 1205

This tripped me up, and combinations of deleting and gitignore was not getting rid of it. End up using a combo of git log --name-only to find the commit and then reset soft back 14 commits or so git reset --soft HEAD~14 back to the commit before to remove it add to gitignore and then commit and get back to work.

Upvotes: 0

Alish Giri
Alish Giri

Reputation: 2238

check your log, find out where you might have accidentally committed that file and get the hash from it using,

git log --name-only

copy the first 7 characters from the log history use,

git checkout 7_character_string android/java_pid0000.hprof

java_pid0000.hprof -> this should match your file name which will show up after push failed.

Upvotes: 2

PortgasAce
PortgasAce

Reputation: 11

maybe jdk is not correct.

android studio - file - project structure - sdk location - jdk location - use embedded jdk

can solve your problem

Upvotes: -2

UmAnusorn
UmAnusorn

Reputation: 11124

When you're monitoring memory usage in the Memory Monitor included in Android Monitor you can, at the same time, dump a snapshot of the Java heap to an Android-specific Heap/CPU Profiling (HPROF) file. The HPROF Viewer displays classes, instances of each class, and a reference tree to help you track memory usage and find memory leaks. HPROF is a binary heap dump format originally supported by J2SE.

You can delete it.

https://developer.android.com/studio/profile/am-hprof.html

Upvotes: 34

Related Questions