Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

should error on resize of foreign-buffer arrays #3430

Closed
Keno opened this issue Jun 17, 2013 · 6 comments
Closed

should error on resize of foreign-buffer arrays #3430

Keno opened this issue Jun 17, 2013 · 6 comments

Comments

@Keno
Copy link
Member

Keno commented Jun 17, 2013

Right now we allow buffers which Julia did not allocate itself to be resized by allocating a new buffer and copying the data over.
Instead @JeffBezanson and I came to the conclusion that it would be a good idea to disallow any kind of operation that could change the memory in which the array is allocated (mostly resize). This would also allow us to expose an Array API as well as having a convenience MmmapArray API for mmaped Arrays, where the former would essentially only allow get/set.

@timholy
Copy link
Member

timholy commented Jun 17, 2013

I personally like the idea of a separate MmapArray type.

@JeffBezanson
Copy link
Member

To clarify, the intent of this issue is just to give an error for resize! on an array where julia didn't allocate the memory.

@StefanKarpinski
Copy link
Member

The amount of trouble caused by being able to resize arrays often makes me wonder if it's worth it.

@JeffBezanson
Copy link
Member

Well, it causes trouble because it's so powerful.

There is a decent chance we should have a dequeue type of some sort instead, and the ability to make an Array from one without copying. IOBuffer could probably be modified to fill this role; then you would incrementally build arrays the same way as for strings.

@StefanKarpinski
Copy link
Member

Yeah, that's kind of what I was thinking. It seems to me that it's uncommon to both need to build an array incrementally and need it to have contiguous layout. You generally build things incrementally when you just want to compile a list of things. One thought is that cell arrays could be a distinct type from Array{Any} and be growable.

@JeffBezanson
Copy link
Member

Growable byte arrays are clearly necessary at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants