# Re: perforce import: git-p4 memory usage

3 messages from 2008-05-23 to 2008-05-23. Participants: Andreas Ericsson, Logan Kennelly, Luke Diamand.
Thread: https://gitlist.dev/t/13632

## Luke Diamand, 2008-05-23 10:07

Subject: perforce import: git-p4 memory usage
Message-ID: <H1SlcXmh.1211537268.4996380.lgd@diamand.org>
URL: https://gitlist.dev/e/H1SlcXmh.1211537268.4996380.lgd%40diamand.org
In-Reply-To: <20080522160414.GA11158@sigill.intra.peff.net>

```

Hi!

I'm trying to import part of a perforce repo with git-p4.

However, git-p4 appears to try to read all the repo into memory (and
moreover seems to need about twice as much memory as repo).

Once it runs out of swap, it dies (unsurprisingly).

I think it's failing in readP4Files(), where it appears to read the
entire repository in one go with "p4 -G -x - print".

Can I just rework this function to do stuff one file at a time? Or is
that dumb?

Thanks
Luke Diamand

```

## Andreas Ericsson, 2008-05-23 11:25

Subject: Re: perforce import: git-p4 memory usage
Message-ID: <4836A9B8.6070804@op5.se>
URL: https://gitlist.dev/e/4836A9B8.6070804%40op5.se
In-Reply-To: <H1SlcXmh.1211537268.4996380.lgd@diamand.org>

```
Luke Diamand wrote:
> Hi!
> 
> I'm trying to import part of a perforce repo with git-p4.
> 
> However, git-p4 appears to try to read all the repo into memory (and
> moreover seems to need about twice as much memory as repo).
> 
> Once it runs out of swap, it dies (unsurprisingly).
> 
> I think it's failing in readP4Files(), where it appears to read the
> entire repository in one go with "p4 -G -x - print".
> 
> Can I just rework this function to do stuff one file at a time? Or is
> that dumb?
> 

It's probably a lot slower, and since git works with changesets it
probably won't work all that good unless you somehow construct some
middle-stage which you can then feed to git-fastimport or some such.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

```

## Logan Kennelly, 2008-05-23 22:27

Subject: Re: perforce import: git-p4 memory usage
Message-ID: <C3A347D5-E9E2-4AEB-96EC-179972224CB3@sent.com>
URL: https://gitlist.dev/e/C3A347D5-E9E2-4AEB-96EC-179972224CB3%40sent.com
In-Reply-To: <H1SlcXmh.1211537268.4996380.lgd@diamand.org>

```
On May 23, 2008, at 3:07 AM, Luke Diamand wrote:

> However, git-p4 appears to try to read all the repo into memory (and
> moreover seems to need about twice as much memory as repo).
>
> Once it runs out of swap, it dies (unsurprisingly).
>
> I think it's failing in readP4Files(), where it appears to read the
> entire repository in one go with "p4 -G -x - print".
>
> Can I just rework this function to do stuff one file at a time? Or is
> that dumb?


I don't know if they were ever accepted into the mainline, but see the
series of patches submitted by Tommy Thorn.

http://article.gmane.org/gmane.comp.version-control.git/72342

-- 
                                                         Logan Kennelly
       ,,,
      (. .)
--ooO-(_)-Ooo--

```
