Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » Memory Leak
Memory Leak [message #1018282] Wed, 13 March 2013 14:57 Go to next message
yaroslav Molodkov is currently offline yaroslav Molodkov
Messages: 4
Registered: March 2013
Junior Member
Hi all.
I have task to expand the existing qvto script. Volume of data to be processed is large but not critical. The resulting file in my estimatino will not exceed 30Mb.
And everything was fine, but the script is terminated using all the memory (I allocated 1024m win32). I use profiler and

Somehow number of EValueImpl objects increased

below the results of my profiling
my.jetscreenshot.com/demo/20130313-zbi1-257kb
my.jetscreenshot.com/demo/20130313-06fj-175kb
Re: Memory Leak [message #1018316 is a reply to message #1018282] Wed, 13 March 2013 15:51 Go to previous messageGo to next message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo Herrera
Messages: 253
Registered: July 2009
Senior Member
On 13/03/2013 14:57, yaroslav Molodkov wrote:
> Somehow number of EValueImpl objects increased
> below the results of my profiling
> my.jetscreenshot.com/demo/20130313-zbi1-257kb
> my.jetscreenshot.com/demo/20130313-06fj-175kb

Without a way to reproduce the problem, it's not trivial to diagnose.

From your screenshot it looks like some leaking around the traces
management. I've raised[1] a vague descriptive bugzilla[1] in the same
way vague/lack of test cases/reproducible example.

Cheers,
Adolfo.

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=403219
Re: Memory Leak [message #1018329 is a reply to message #1018282] Wed, 13 March 2013 16:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4037
Registered: July 2009
Senior Member
Hi

What existing qvto script?

What is the basis for your 30MB estimation?

With models, there is usually very little point looking at thousands of
small objects, much better to look at the relatively small number of
Resource/ResourceSet.

What do the priofile results mean...

You need to do a lot more work yourself before we can look at anything.

Regards

Ed Willink



On 13/03/2013 14:57, yaroslav Molodkov wrote:
> Hi all.
> I have task to expand the existing qvto script. Volume of data to be
> processed is large but not critical. The resulting file in my
> estimatino will not exceed 30Mb.
> And everything was fine, but the script is terminated using all the
> memory (I allocated 1024m win32). I use profiler and
> Somehow number of EValueImpl objects increased
> below the results of my profiling
> my.jetscreenshot.com/demo/20130313-zbi1-257kb
> my.jetscreenshot.com/demo/20130313-06fj-175kb
Re: Memory Leak [message #1018816 is a reply to message #1018329] Thu, 14 March 2013 14:23 Go to previous messageGo to next message
yaroslav Molodkov is currently offline yaroslav Molodkov
Messages: 4
Registered: March 2013
Junior Member
Hi,

I have found piece of code with the problem:
mapping uml::Property::recursiveProcedure(
		inout parentNode : mdmi::Bag,
		in parentContainerClass : uml::Class, 		
		in someData: Dict(String, Integer),
		in someData1: someType1,
		... 
		in someDataN: someTypeN) {
	if (some_conditions) then{ // so recursion is not infinite!!!
			.......
			bag := generateBag(self, parentContainerClass);
			self.type.oclAsType(uml::Class).ownedAttribute->
                          select(attr| (attr.lower >= 0 or attr.name = "templateId"))->map		
				recursiveProcedure( bag, 
                                self.type.oclAsType(uml::Class), 			
				someData1,
				someData2,
				...
		                someDataN);
	}  endif;
}

It uses recursion to tree traversal UML model. The tree is quite deep (20) and wide.
I think that when we exit the recursive function, memory does not free.
I did some experiments:
1) Changed the number of passed someData arguments. As expected the more arguments the faster memory is lost
2) Use inout instead of in (I hoped we pass reference and do not create a copy of object) did not help
3) Tried to clear object(ofcourse obj := null doesn't work becouse it is input argument) since I've been experimenting with a type Dict
someData->clear();
someData1->clear();
...
someDataN->clear();
memory leak was much slower. but still on.

So what can I do for fix it?
I really do not want to refuse recursion, because the existing script is really big and I will rewrite it too long.
Re: Memory Leak [message #1018868 is a reply to message #1018816] Thu, 14 March 2013 15:36 Go to previous message
Adolfo Sanchez-Barbudo Herrera is currently offline Adolfo Sanchez-Barbudo Herrera
Messages: 253
Registered: July 2009
Senior Member
Hi Yaroslav,

Suggestions:

1. If you doesn't need any mapping extension mechanism and any
traceability, I suggest you using a "helper" operation rather than a
"mapping" operation, because the former doesn't deal with traces.

2. Go on the discussion in the open bugzilla [1]. It would be great if
you provide some test cases in which we may reproduce the problem.

3. If something works for you, I'd recommend sharing the solution with
the community ;) (We haven't received any feedback from the suggestion
we did in your other question ;) )

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=403219

Cheers,
Adolfo.

On 14/03/2013 14:23, yaroslav Molodkov wrote:
> Hi,
> I have found piece of code with the problem:
>
> mapping uml::Property::recursiveProcedure(
> inout parentNode : mdmi::Bag,
> in parentContainerClass : uml::Class,
> in someData: Dict(String, Integer),
> in someData1: someType1,
> ... in someDataN: someTypeN) {
> if (some_conditions) then{ // so recursion is not infinite!!!
> .......
> bag := generateBag(self, parentContainerClass);
> self.type.oclAsType(uml::Class).ownedAttribute->
> select(attr| (attr.lower >= 0 or attr.name = "templateId"))->map
> recursiveProcedure( bag, self.type.oclAsType(uml::Class),
> someData1,
> someData2,
> ...
> someDataN);
> } endif;
> }
>
> It uses recursion to tree traversal UML model. The tree is quite deep
> (20) and wide.
> I think that when we exit the recursive function, memory does not free.
> I did some experiments:
> 1) Changed the number of passed someData arguments. As expected the more
> arguments the faster memory is lost
> 2) Use inout instead of in (I hoped we pass reference and do not create
> a copy of object) did not help
> 3) Tried to clear object(ofcourse obj := null doesn't work becouse it is
> input argument) since I've been experimenting with a type Dict
> someData->clear();
> someData1->clear();
> ...
> someDataN->clear();
> memory leak was much slower. but still on.
>
> So what can I do for fix it? I really do not want to refuse recursion,
> because the existing script is really big and I will rewrite it too long.
>
Previous Topic:Using blackbox in a qvt transformation called by java
Next Topic:Tansformation with Multiple source models - Single output model
Goto Forum:
  


Current Time: Tue Sep 02 23:49:05 GMT 2014

Powered by FUDForum. Page generated in 0.02196 seconds