Is exec a good software solution to ant OutOfMemory problems?

This question requires a little background ... In my company, we are creating a set of PDF and HTML files. A very large set. The current build process (which I developed, in a hurry) is a Perl script that reads a set of files, where each file contains a new ant command to execute.

It is created horribly.

Now I'm trying to move the whole project to using ant for most tasks. Within the framework of the object, I can create a list of files that need to be created, both PDF and HTML. However, when I call the ant command to build each file, after about three builds (say five), the whole process crashes with an OutOfMemory error. In addition, my buildlog.xml ends with something like 20 megabytes - it combines each output of the ant command into one giant log, because it is called from the same target. With an earlier Perl solution, I was able to get the buildlog.xml file for each ant command - just save and rename buildlog to another.

Even if I set the dimensions to w40> or java heaps in my user.properties, I will still fail with OOM. I wonder if the appropriate solution for calling <exec> suitable for running a script that executes some of what I described and what I want: namely, to call ant, rename buildlog and die - theoretically allocating and freeing space is better than one "giant" call ant. It bothers me that I am going to lead another "hacker" solution to a problem that is clearly defined and can be completely limited by ant. Again, <exec> exists for some reason, so shouldn't I use it badly?

+4
source share
1 answer

As with most corporate programs (at least for those who have deadlines, and if you don’t, let me know where you work so I can try to get a job there), the first step is to get it to work.

Then, worry about it working well.

For this first step, you can use any tool at your disposal, no matter how ugly you think it looks.

But you might want to make sure that the forces that need to know that you had to do all kinds of unpleasant things to get them to work for them, so that they let you hope to fix this before the service starts. You probably don't want to maintain a terribly ugly code base or design.

We unleashed miracles in the world, such as applications that shut themselves down at night to avoid memory leaks (leaving the OS to restart them), placing “dubious” code on the other end of the TCP socket so that their failure doesn’t run, “they crash the main application and I am sure many other horrors that my brain decided to remove all traces of.

+1
source

Source: https://habr.com/ru/post/1335923/


All Articles