Memory limit reached - Precompile .tikz plots - How to output pdf with papersize near to image [closed]

Okay, well I have a problem my `.tex` file has reached the memory limit. Now I tried to change the memory limit `/usr/share/texmf/web2c/texmf.cnf` however that does not work. It keeps saying `pdflatex> ! TeX capacity exceeded, sorry [main memory size=3000000]`. From which I conclude the setting is not readed by the compiler.

A little background info...

I have installed texlive twice... yes twice (at least I think I have). I first installed it using the texlive packages in the UbuntuSoftwareCenter. And recently I tried to install it, because of the I want to make use of the `tlmgr` command, by the following description, How to install "vanilla" TeXLive on Debian or Ubuntu?. However I think the installation failed, because I still can not use the `tlmgr` command.

Back to topic. Now with matlab and matlab2tikz I generated a `.tikz` plot which is 44.3mb o_O yes I know 44.3mb lol now I still want to have this `.tikz` plot compiled so all my plots look the same. Now I was thinking of precompiling all the plots single handed and then use the `.pdf` in my `.tex` file instead of the `.tikz` file. Now when I compile this however the `.pdf` will just be a4paper size and a plot in the middle. I want to know how latex can compile a `.pdf` with just a 1cm boundary to the plot, like you see in those `.tikz` examples on texample.net, http://www.texample.net/tikz/examples/dandelin-spheres/.

Note: I already tried to only compile the 44.3mb `.tikz` image single handed and it failed :-(, this does not mean I don't want a answer to the question asked, because it is still usefull for me to know how to generate a `.pdf` in latex with a paper-size close image, but if anyone has a suggestion on how to compile the 44.3 mb `.tikz` plot feel free to comment.

-
You can use `lualatex` instead of `pdflatex`, which can dynamically increase the available memory. It can basically be used as a drop-in replacement for `pdflatex`, except for some things like `microtype`, so maybe it's best to use it only for the image. Why is it 44.3 MB, though? Surely you'd be able to downsample your data before generating the code, it's unlikely that all that information will be useful in your final PDF (plus the PDF will most likely be huge as well). –  Jake Jun 6 '12 at 18:00
You should also be able to use the `standalone` package (or preview package) to crop the image with the desired border. –  Peter Grill Jun 6 '12 at 18:14
@Jake the microtype beta on tlcontrib works fine with lualatex. –  Peter Breitfeld Jun 6 '12 at 19:11
@PeterBreitfeld: Ah, that's good to know! That's one of the few things that kept me from switching to `lualatex` (the other was some issue I had with font encoding, but I might have to look into that again, perhaps it was only something I did wrong). –  Jake Jun 6 '12 at 19:20
What kind of plot is this? Find it hard to believe that you need all those points, as Jake already have pointed out. –  militiaOfDeath Jun 6 '12 at 20:28