[V4CC] I have decide return back VCursor constructor.

Thorsten Hohage thohage at genericobjects.de
Sat Aug 28 03:15:38 CDT 2010


Hi,

On 2010-08-28, at 07:17, Ruslan Zasukhin wrote:

>> 
>> While you're at it it would be really nice if you consider to return
>> autoreleased objects from cursor methods like
>> [cursor fieldAtIndex:]
> 
> NO.

Hm, but it would be compliant with most (all) Apple classes I know. Getting back an object mostly (always) means that this is in autorelease pool an I need to take care to e.g. retain it, Btw. THAT's the reason why in most Apple examples

	self.myField = [someClass coolObject];

is used and not

	myField = [someClass coolObject];

even more the last one would give you great hassle for sure.


*DISCLAIMER* *DISCLAIMER* I did not check all this with V4.7 or V4.8, but all that works perfectly - but of course it might be, that it is not necessary any more in 4.8 *DISCLAIMER* *DISCLAIMER*


> I think you wrong here. I have see you did add autorelease in
>    [[cursor field:xx] autorelase]
> 
> In the test example in mantis. Why ???

Perhaps he has seen something similar in my code ?

	for(index=1;index <= maxCount;index++) {
		
		vField = [cursor fieldAtIndex:index];
		
		if ([cursor position] == 1) {
			[vField autorelease];
		}

		....

If NOT doing the [vField autorelease]; you'll get a great number of leaks.  


> I have remove them in your test and all perfectly works.
You remove them and do carefully check memory allocation / leaks / zombies in Instruments OR you remove it and run he code? 


> And in our V4CC examples we do not do this.
> So why you think you was need that ?
Because I was hunting leaks for about a week and the above one WAS the solution.

I your examples you didn't do many thing a complex app would do ;-) ... e.g. do you really run more then one cursor on the DB in the same request/response ... cycle?  As far as I can see - NO!

Do you set properties and perhaps do some more complex things with "cocoa object values" from the value of a vField while in the loop? As far as I can see - NO!


And I'm afraid if I would now take the time to check every example for real world proofeness, I'm not sure, what I'll will see. But disappointedly I need to get some food for the weekend. 


Ruslan, your example are really good to illustrate how Valentina works, to learn developing with Valentina and to finde many of the beginners issue doing when working with Valentina, but IMHO they are NOT a full proof in mathematical sense of a proof.



> We have internally COMPLEX integration between V4CC objects and KERNEL
> objects. 
Yes, btw. THAT's the reason why I needed a second fix after discovered that

	vField = [cursor fieldAtIndex:index];

was leaking. Because then I got a nice Zombie and the fix was 

	if ([cursor position] == 1) {
		[vField autorelease];
	}




regards,

Thorsten Hohage
-- 

Valentina Technology Evangelist
generic objects  GmbH - Leiter Solution Center Nord



More information about the Valentina mailing list