Limit of the #become:

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Limit of the #become:

Mariano Martinez Peck
Hi guys. I noticed that there is a limit in the number of objects you can become. In my case, I am becoming 2312157 objects. So..I don't expect that the become works. I imagine that it was not designed for so many objects in mind ;)
However, what I would really understand is where is the limitation and the reason. And of course, if someone already knows which is the real number limit. Otherwise, I will do a kind of binary search and discover it.

If you want to reproduce it:

| dict |
dict := Dictionary new.
2312157 timesRepeat: [ dict at: Object new put: Object new ].
3 timesRepeat: [Smalltalk garbageCollect].
dict keys elementsForwardIdentityTo: dict values.

throws a #primitiveFailed.    

Thanks,

--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Limit of the #become:

Mariano Martinez Peck


On Wed, Apr 4, 2012 at 5:32 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys. I noticed that there is a limit in the number of objects you can become. In my case, I am becoming 2312157 objects. So..I don't expect that the become works. I imagine that it was not designed for so many objects in mind ;)
However, what I would really understand is where is the limitation and the reason. And of course, if someone already knows which is the real number limit. Otherwise, I will do a kind of binary search and discover it.

If you want to reproduce it:

| dict |
dict := Dictionary new.
2312157 timesRepeat: [ dict at: Object new put: Object new ].
3 timesRepeat: [Smalltalk garbageCollect].
dict keys elementsForwardIdentityTo: dict values.

throws a #primitiveFailed.    

Of course the following works correctly:

| dict tmp |
dict := Dictionary new.
2312157 timesRepeat: [dict at: Object new put: Object new].
3 timesRepeat: [Smalltalk garbageCollect].
dict associations groupsOf: 50000 atATimeDo: [:each |
    tmp := Dictionary withAll: each.
    tmp keys elementsForwardIdentityTo: tmp values
    ]


So... indeed, there seems to be a limit with the amount of objects.

 

Thanks,

--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Limit of the #become:

csrabak
In reply to this post by Mariano Martinez Peck
Mariano,

In fact, presently use of become is not considered good OOP so at first
my humble suggestion is you consider revising the whole architecture
in order to understand why you need such a thing and find a better
[design] pattern.

HTH

--
Cesar Rabak


Em 04/04/2012 12:32, Mariano Martinez Peck < [hidden email] > escreveu:

> Hi guys.  I noticed that there is  a limit in the  number of objects
> you can  become. In  my case, I  am becoming 2312157  objects. So..I
> don't  expect that  the  become works.  I  imagine that  it was  not
> designed for so many objects in mind ;)
>  However, what I would really  understand is where is the limitation
>  and the  reason. And of course,  if someone already  knows which is
>  the real number limit. Otherwise, I will do a kind of binary search
>  and discover it.
>   If you want to reproduce it:
> | dict |
> dict := Dictionary new.
> 2312157 timesRepeat: [ dict at: Object new put: Object new ].
> 3 timesRepeat: [Smalltalk garbageCollect].
> dict keys elementsForwardIdentityTo: dict values.
>
> throws a #primitiveFailed.    
>
> Thanks,

Reply | Threaded
Open this post in threaded view
|

Re: Limit of the #become:

Igor Stasenko
On 4 April 2012 23:25,  <[hidden email]> wrote:
> Mariano,
>
> In fact, presently use of become is not considered good OOP so at first
> my humble suggestion is you consider revising the whole architecture
> in order to understand why you need such a thing and find a better
> [design] pattern.
>

there is no other way to represent an object by proxy, which is not
yet in memory, but loaded on demand.
otherwise you will be forced to make an outer object (which refers to
a proxy), to know it
and replace a reference to it with another object.


> HTH
>
> --
> Cesar Rabak
>
>
> Em 04/04/2012 12:32, Mariano Martinez Peck < [hidden email] > escreveu:
>
>> Hi guys.  I noticed that there is  a limit in the  number of objects
>> you can  become. In  my case, I  am becoming 2312157  objects. So..I
>> don't  expect that  the  become works.  I  imagine that  it was  not
>> designed for so many objects in mind ;)
>>  However, what I would really  understand is where is the limitation
>>  and the  reason. And of course,  if someone already  knows which is
>>  the real number limit. Otherwise, I will do a kind of binary search
>>  and discover it.
>>   If you want to reproduce it:
>> | dict |
>> dict := Dictionary new.
>> 2312157 timesRepeat: [ dict at: Object new put: Object new ].
>> 3 timesRepeat: [Smalltalk garbageCollect].
>> dict keys elementsForwardIdentityTo: dict values.
>>
>> throws a #primitiveFailed.
>>
>> Thanks,
>



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: Limit of the #become:

Frank Shearar-3
On 4 April 2012 22:32, Igor Stasenko <[hidden email]> wrote:

> On 4 April 2012 23:25,  <[hidden email]> wrote:
>> Mariano,
>>
>> In fact, presently use of become is not considered good OOP so at first
>> my humble suggestion is you consider revising the whole architecture
>> in order to understand why you need such a thing and find a better
>> [design] pattern.
>>
>
> there is no other way to represent an object by proxy, which is not
> yet in memory, but loaded on demand.
> otherwise you will be forced to make an outer object (which refers to
> a proxy), to know it
> and replace a reference to it with another object.

And this seems like precisely one of those times you really do want to
reach into the magic toolbox for #become:. Sometimes you really do
need it.

frank

>> HTH
>>
>> --
>> Cesar Rabak
>>
>>
>> Em 04/04/2012 12:32, Mariano Martinez Peck < [hidden email] > escreveu:
>>
>>> Hi guys.  I noticed that there is  a limit in the  number of objects
>>> you can  become. In  my case, I  am becoming 2312157  objects. So..I
>>> don't  expect that  the  become works.  I  imagine that  it was  not
>>> designed for so many objects in mind ;)
>>>  However, what I would really  understand is where is the limitation
>>>  and the  reason. And of course,  if someone already  knows which is
>>>  the real number limit. Otherwise, I will do a kind of binary search
>>>  and discover it.
>>>   If you want to reproduce it:
>>> | dict |
>>> dict := Dictionary new.
>>> 2312157 timesRepeat: [ dict at: Object new put: Object new ].
>>> 3 timesRepeat: [Smalltalk garbageCollect].
>>> dict keys elementsForwardIdentityTo: dict values.
>>>
>>> throws a #primitiveFailed.
>>>
>>> Thanks,
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>

Reply | Threaded
Open this post in threaded view
|

Re: Limit of the #become:

Stéphane Ducasse
+ 1

>>>
>>> In fact, presently use of become is not considered good OOP so at first
>>> my humble suggestion is you consider revising the whole architecture
>>> in order to understand why you need such a thing and find a better
>>> [design] pattern.
>>>
>>
>> there is no other way to represent an object by proxy, which is not
>> yet in memory, but loaded on demand.
>> otherwise you will be forced to make an outer object (which refers to
>> a proxy), to know it
>> and replace a reference to it with another object.
>
> And this seems like precisely one of those times you really do want to
> reach into the magic toolbox for #become:. Sometimes you really do
> need it.


Reply | Threaded
Open this post in threaded view
|

Re: Limit of the #become:

Mariano Martinez Peck
In reply to this post by Frank Shearar-3


On Wed, Apr 4, 2012 at 11:51 PM, Frank Shearar <[hidden email]> wrote:
On 4 April 2012 22:32, Igor Stasenko <[hidden email]> wrote:
> On 4 April 2012 23:25,  <[hidden email]> wrote:
>> Mariano,
>>
>> In fact, presently use of become is not considered good OOP so at first
>> my humble suggestion is you consider revising the whole architecture
>> in order to understand why you need such a thing and find a better
>> [design] pattern.
>>
>
> there is no other way to represent an object by proxy, which is not
> yet in memory, but loaded on demand.
> otherwise you will be forced to make an outer object (which refers to
> a proxy), to know it
> and replace a reference to it with another object.

And this seems like precisely one of those times you really do want to
reach into the magic toolbox for #become:. Sometimes you really do
need it.

Thanks Carlos for the advice. Since Igor knows what I am doing, he answered for me ;)
So yes....I am swappout graphs between primary and secondary memory and there are objects that I need to become to proxies and vice-versa.
This is not an app what I am doing, but a kind of hacky stuff implemented at the object side.

Cheers
 

frank

>> HTH
>>
>> --
>> Cesar Rabak
>>
>>
>> Em 04/04/2012 12:32, Mariano Martinez Peck < [hidden email] > escreveu:
>>
>>> Hi guys.  I noticed that there is  a limit in the  number of objects
>>> you can  become. In  my case, I  am becoming 2312157  objects. So..I
>>> don't  expect that  the  become works.  I  imagine that  it was  not
>>> designed for so many objects in mind ;)
>>>  However, what I would really  understand is where is the limitation
>>>  and the  reason. And of course,  if someone already  knows which is
>>>  the real number limit. Otherwise, I will do a kind of binary search
>>>  and discover it.
>>>   If you want to reproduce it:
>>> | dict |
>>> dict := Dictionary new.
>>> 2312157 timesRepeat: [ dict at: Object new put: Object new ].
>>> 3 timesRepeat: [Smalltalk garbageCollect].
>>> dict keys elementsForwardIdentityTo: dict values.
>>>
>>> throws a #primitiveFailed.
>>>
>>> Thanks,
>>
>
>
>
> --
> Best regards,
> Igor Stasenko.
>




--
Mariano
http://marianopeck.wordpress.com